Skip to content

Commit

Permalink
Fix benchmark test names for parsing CSV strings
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiazya committed Sep 14, 2024
1 parent c4602fd commit c8b2ce9
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions packages/parser/src/lib/parseString.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,30 @@ import { parseString } from "./parseString.js";
describe.each([50, 100, 500, 1_000])("%d row", (row) => {
const string = getStringCSV(row);

bench(`parse a string ${row} CSV to an AsyncIterableIterator`, async () => {
for await (const _ of parseString(string)) {
// noop
}
});

bench(`parse a string ${row} CSV to an Array`, () => {
bench(
`parse a string ${row} row CSV to an AsyncIterableIterator`,
async () => {
for await (const _ of parseString(string)) {
// noop
}
},
);

bench(`parse a string ${row} row CSV to an Array`, () => {
parseString.toArraySync(string);
});

bench(`parse a string ${row} CSV to a Promise<Array>`, async () => {
bench(`parse a string ${row} row CSV to a Promise<Array>`, async () => {
await parseString.toArray(string);
});

bench(`parse a string ${row} CSV to a IterableIterator`, () => {
bench(`parse a string ${row} row CSV to a IterableIterator`, () => {
for (const _ of parseString.toIterableIterator(string)) {
// noop
}
});

bench(`parse a string ${row} CSV to a ReadableStream`, async () => {
bench(`parse a string ${row} row CSV to a ReadableStream`, async () => {
await parseString.toStream(string).pipeTo(
new WritableStream({
write(_) {
Expand Down

0 comments on commit c8b2ce9

Please sign in to comment.