Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR is a rewriting of the CSV library, it should now be easier to use and should not fail anymore due to `\r\n` being the default, this one has been replaced by a single `\n` character. The `CSVFormat` class has been removed since it introduced more complexity than usefulness, and now the separator, eol and delimiter can be set independently after creation of the `CsvDocument` or a `CsvReader/Writer`. Concerning performance, the new parser is way faster than the old one. On a simple 4Mio file, parsing used to take 2.401s. On the new parser, the measured user time is 0.179s, hence an improvement by a factor of ~12. Old code sample ~~~nit import csv var fl = new FileReader.open(args[0]) var rd = new CsvReader.with_format(fl, new CsvFormat('"', ',', "\r")) var lns = new Array[Array[String]] for i in rd do lns.add i ~~~ New code sample ~~~nit import csv var rd = new CsvReader.from_string(args[0].to_path.read_all) rd.eol = "\r" rd.read_all ~~~ Pull-Request: #2048 Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net> Reviewed-by: Jean Privat <jean@pryen.org>
- Loading branch information