Skip to content

Commit 2badfaa

Browse files
committed
fix(bench): Reduce primitives benchmark to prevent browser tab crash during bench:save
Trim to 5 representative primitives (rect, circle, group, text, path) and cap scaling at 250 instances. The full suite with 7 primitives and 1000-instance scaling accumulated enough memory to crash the browser tab when run alongside all other benchmark suites.
1 parent 6566f57 commit 2badfaa

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

packages/layerchart/src/lib/bench/primitives.svelte.bench.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ afterEach(() => {
77
cleanup();
88
});
99

10-
const PRIMITIVES = ['rect', 'circle', 'ellipse', 'line', 'group', 'text', 'path'] as const;
1110
const COUNT = 100;
1211

1312
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1413
// LayerChart primitives vs native SVG elements — 100 instances each
14+
//
15+
// Representative subset: rect (shape), circle (shape), group (container),
16+
// text (complex), path (path-based). Ellipse/line follow the same
17+
// architecture as rect/circle and would show the same ratio.
1518
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1619

20+
const PRIMITIVES = ['rect', 'circle', 'group', 'text', 'path'] as const;
21+
1722
for (const primitive of PRIMITIVES) {
1823
describe(`${primitive}${COUNT} instances`, () => {
1924
bench(`Native <${primitive}>`, () => {
@@ -29,11 +34,11 @@ for (const primitive of PRIMITIVES) {
2934
}
3035

3136
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
32-
// Scaling: 10, 100, 500, 1000 instances (rect as representative)
37+
// Scaling: rect at 10, 100, 250 instances
3338
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3439

3540
describe('rect — scaling', () => {
36-
for (const count of [10, 100, 500, 1000]) {
41+
for (const count of [10, 100, 250]) {
3742
bench(`Native <rect> × ${count}`, () => {
3843
cleanup();
3944
render(PrimitiveBench, { primitive: 'rect', mode: 'native', count });
@@ -45,17 +50,3 @@ describe('rect — scaling', () => {
4550
});
4651
}
4752
});
48-
49-
describe('circle — scaling', () => {
50-
for (const count of [10, 100, 500, 1000]) {
51-
bench(`Native <circle> × ${count}`, () => {
52-
cleanup();
53-
render(PrimitiveBench, { primitive: 'circle', mode: 'native', count });
54-
});
55-
56-
bench(`LayerChart <Circle> × ${count}`, () => {
57-
cleanup();
58-
render(PrimitiveBench, { primitive: 'circle', mode: 'layerchart', count });
59-
});
60-
}
61-
});

0 commit comments

Comments
 (0)