From: Ardis Lu Date: Fri, 14 Feb 2025 07:43:04 +0000 (-0800) Subject: Add 50MB benchmarks X-Git-Tag: v0.1.0~53 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=4148e1cd2d6afab6642ccec8d394170337632a5f;p=csvio Add 50MB benchmarks --- diff --git a/benchmark/core.bench.js b/benchmark/core.bench.js index 953fdc3..b7b4340 100644 --- a/benchmark/core.bench.js +++ b/benchmark/core.bench.js @@ -24,6 +24,20 @@ await benchmarkIterations('Transform 1MB'.padEnd(NAME_LENGTH, '.'), 20, async () for await (const _ of r) { } }); +await benchmark('Write 50MB'.padEnd(NAME_LENGTH, '.'), async () => { + await createRandomCSV(50000, 100, iter++).pipeTo(new CSVWriter(temp)); +}); + +await benchmark('Read 50MB'.padEnd(NAME_LENGTH, '.'), async () => { + const r = new CSVReader(temp); + for await (const _ of r) { } +}); + +await benchmark('Transform 50MB'.padEnd(NAME_LENGTH, '.'), async () => { + const r = createRandomCSV(50000, 100, iter++).pipeThrough(new CSVTransformer(r => r.map(f => Number(f) + 1))); + for await (const _ of r) { } +}); + await benchmark('Write 100MB'.padEnd(NAME_LENGTH, '.'), async () => { await createRandomCSV(100000, 100, iter++).pipeTo(new CSVWriter(temp)); });