Show HN: uDSV.js – A faster CSV parser (github.com)
Hey folks!
I know CSV parsers (especially in JS) aren't terribly exciting and someone writes a "better" one every week.
I'm in the middle of my parental leave, and this was a project that came out of me looking for the fastest/smallest CSV parser. It all started so innocently, and then turned into a benchmark-validation-athon; the library itself took ~2 weeks to write, but the performance comparisons took another ~4 weeks (on and off).
The benchmarks were a huge effort, but I think they are the most thorough to date, both in breadth and in depth, so hopefully you find them useful: https://github.com/leeoniya/uDSV/tree/main/bench
Let me know if you have specific concerns / questions / improvements :)
cheers! Leon
26 comments
[ 2.7 ms ] story [ 59.4 ms ] threadAt that point, I think the speed is limited by boxing JS objects.
at some point it makes sense to simply recommend using WASM SQLite (or DuckDB) to load the data for OLAP stuff. im not gonna encourage anyone to use JS on multi-GB files. even a few hundred MB becomes questionable ;)
i'll take a look and see if i can incorporate Perspective's parser into the bench, thanks!
the runner is designed to read results.length, but we're not accumulating in this case, so the rows/s math is...off :)
d3-dsv is one of the better ones for sure. it even slightly beats uDSV in Bun on some benchmarks. maybe it's better optimized for JSC rather than V8.
it doesnt do streaming tho and the typed performance is rather behind since it's BYO conversion rather than compiled for you via `new Function()`
(https://github.com/leeoniya/uPlot)
https://leeoniya.github.io/uPlot/demos/stacked-series.html
So even if I don't end up using uFuzzy, I still end up using uFuzzy!
be careful with this. the settings for other libs are hardcoded to be as close to uFuzzy as possible, so you can definitely get worse/better results depending on how you config each lib for your needed use case.
I had some fun looking through them and seeing how comma-separated-values — a package I authored ~9 years ago and posted to Show HN as well fared.