MCPcopy
hub / github.com/react-grid-layout/react-grid-layout / measureRenderTime

Function measureRenderTime

test/spec/benchmark-test.js:70–84  ·  view source on GitHub ↗
(Component, props, iterations = 10)

Source from the content-addressed store, hash-verified

68
69// Render component and measure time
70function measureRenderTime(Component, props, iterations = 10) {
71 const times = [];
72
73 for (let i = 0; i < iterations; i++) {
74 const start = performance.now();
75 const { unmount } = render(<Component {...props} />);
76 const end = performance.now();
77 times.push(end - start);
78 unmount();
79 }
80
81 // Return median to reduce variance
82 times.sort((a, b) => a - b);
83 return times[Math.floor(times.length / 2)];
84}
85
86describe("Performance Benchmarks", () => {
87 // Store results for snapshot comparison

Callers 1

benchmark-test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…