MCPcopy Create free account
hub / github.com/avoidwork/tenso / benchmarkJsonParser

Function benchmarkJsonParser

benchmarks/parsers.js:75–99  ·  view source on GitHub ↗

* Benchmarks JSON parser performance

()

Source from the content-addressed store, hash-verified

73 * Benchmarks JSON parser performance
74 */
75function 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

Callers 1

mainFunction · 0.85

Calls 2

jsonParserFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected