* Comparative parser benchmarks
()
| 160 | * Comparative parser benchmarks |
| 161 | */ |
| 162 | function benchmarkParserComparison () { |
| 163 | console.log("\n📊 Parser Comparison (Medium datasets)"); |
| 164 | console.log("-".repeat(40)); |
| 165 | |
| 166 | const suite = new Benchmark.Suite(); |
| 167 | const jsonParser = parsers.get("application/json"); |
| 168 | const jsonlParser = parsers.get("application/jsonl"); |
| 169 | const formParser = parsers.get("application/x-www-form-urlencoded"); |
| 170 | |
| 171 | suite |
| 172 | .add("JSON Parser (medium)", () => { |
| 173 | jsonParser(testData.json.medium); |
| 174 | }) |
| 175 | .add("JSONL Parser (medium)", () => { |
| 176 | jsonlParser(testData.jsonl.medium); |
| 177 | }) |
| 178 | .add("Form Parser (medium)", () => { |
| 179 | formParser(testData.form.medium); |
| 180 | }) |
| 181 | .on("cycle", event => { |
| 182 | console.log(` ${String(event.target)}`); |
| 183 | }) |
| 184 | .on("complete", function () { |
| 185 | console.log(` Fastest: ${this.filter("fastest").map("name")}`); |
| 186 | console.log(` Slowest: ${this.filter("slowest").map("name")}`); |
| 187 | }) |
| 188 | .run(); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Memory usage test for parsers |
no test coverage detected