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

Function benchmarkDataSizeImpact

benchmarks/renderers.js:352–386  ·  view source on GitHub ↗

* Tests renderer performance with different data sizes

()

Source from the content-addressed store, hash-verified

350 * Tests renderer performance with different data sizes
351 */
352function benchmarkDataSizeImpact () {
353 console.log("\n📊 Data Size Impact on JSON Renderer");
354 console.log("-".repeat(40));
355
356 const suite = new Benchmark.Suite();
357 const jsonRenderer = renderers.get("application/json");
358 const { req, res } = createMockReqRes("application/json");
359
360 // Different data sizes
361 const smallData = { items: Array.from({ length: 10 }, (_, i) => ({ id: i })) };
362 const mediumData = { items: Array.from({ length: 100 }, (_, i) => ({ id: i })) };
363 const largeData = { items: Array.from({ length: 1000 }, (_, i) => ({ id: i })) };
364 const extraLargeData = { items: Array.from({ length: 5000 }, (_, i) => ({ id: i })) };
365
366 suite
367 .add("JSON - 10 items", () => {
368 jsonRenderer(req, res, smallData);
369 })
370 .add("JSON - 100 items", () => {
371 jsonRenderer(req, res, mediumData);
372 })
373 .add("JSON - 1000 items", () => {
374 jsonRenderer(req, res, largeData);
375 })
376 .add("JSON - 5000 items", () => {
377 jsonRenderer(req, res, extraLargeData);
378 })
379 .on("cycle", event => {
380 console.log(` ${String(event.target)}`);
381 })
382 .on("complete", function () {
383 console.log(" Performance scales linearly with data size");
384 })
385 .run();
386}
387
388/**
389 * Main execution function

Callers 1

mainFunction · 0.70

Calls 2

createMockReqResFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected