* Benchmarks JSONL parser performance
()
| 102 | * Benchmarks JSONL parser performance |
| 103 | */ |
| 104 | function benchmarkJsonlParser () { |
| 105 | console.log("\n📊 JSONL Parser Benchmarks"); |
| 106 | console.log("-".repeat(40)); |
| 107 | |
| 108 | const suite = new Benchmark.Suite(); |
| 109 | const jsonlParser = parsers.get("application/jsonl"); |
| 110 | |
| 111 | suite |
| 112 | .add("JSONL Parser - Small (1 line)", () => { |
| 113 | jsonlParser(testData.jsonl.small); |
| 114 | }) |
| 115 | .add("JSONL Parser - Medium (100 lines)", () => { |
| 116 | jsonlParser(testData.jsonl.medium); |
| 117 | }) |
| 118 | .add("JSONL Parser - Large (1000 lines)", () => { |
| 119 | jsonlParser(testData.jsonl.large); |
| 120 | }) |
| 121 | .on("cycle", event => { |
| 122 | console.log(` ${String(event.target)}`); |
| 123 | }) |
| 124 | .on("complete", function () { |
| 125 | console.log(` Fastest: ${this.filter("fastest").map("name")}`); |
| 126 | }) |
| 127 | .run(); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Benchmarks form URL encoded parser performance |