* Benchmarks JSON parser performance
()
| 73 | * Benchmarks JSON parser performance |
| 74 | */ |
| 75 | function benchmarkJsonParser () { |
| 76 | console.log("\n📊 JSON Parser Benchmarks"); |
| 77 | console.log("-".repeat(40)); |
| 78 | |
| 79 | const suite = new Benchmark.Suite(); |
| 80 | const jsonParser = parsers.get("application/json"); |
| 81 | |
| 82 | suite |
| 83 | .add("JSON Parser - Small (2 fields)", () => { |
| 84 | jsonParser(testData.json.small); |
| 85 | }) |
| 86 | .add("JSON Parser - Medium (100 objects)", () => { |
| 87 | jsonParser(testData.json.medium); |
| 88 | }) |
| 89 | .add("JSON Parser - Large (1000 objects)", () => { |
| 90 | jsonParser(testData.json.large); |
| 91 | }) |
| 92 | .on("cycle", event => { |
| 93 | console.log(` ${String(event.target)}`); |
| 94 | }) |
| 95 | .on("complete", function () { |
| 96 | console.log(` Fastest: ${this.filter("fastest").map("name")}`); |
| 97 | }) |
| 98 | .run(); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Benchmarks JSONL parser performance |
no test coverage detected