leeoniya / uDSV

A faster CSV parser in 5KB (min)
MIT License
669 stars 14 forks source link

avoid string concat #11

Closed leeoniya closed 6 months ago

leeoniya commented 6 months ago

i think it will reduce mem use a lot if we just .slice() from start to end and do a .replaceAll() to remove the escaped commas or quotes. not sure this can work for incremental parsing but probably. think this will increase overall perf as well since mem alloc / GC is the slowest thing in JS.

leeoniya commented 6 months ago

done.

this actually lost some perf. i was able to get some of it back, but not all. net loss it maybe up to 10%, depending on corpus.

in Node/V8 it's a small improvement in mem, but in Bun/JSC it's a huge mem reduction (>50%).