← ClaudeAtlas

artifact-performancelisted

Make a data page open fast and stay responsive - render budgets, the SVG-to-canvas threshold, event delegation instead of per-element listeners, virtualization, debouncing and rAF batching, avoiding layout thrash, and measuring rather than guessing. Trigger on "slow page", "janky", "laggy", "takes ages to open", "too many elements", "performance", "canvas vs svg", "optimize the page", "scroll stutter".
Lukehle/chartroom · ★ 0 · Web & Frontend · score 70
Install: claude install-skill Lukehle/chartroom
# Artifact performance Two numbers govern how a data page feels: - **Time to first meaningful paint** — under ~1s or it feels broken - **Interaction response** — under ~100ms or it feels laggy Everything below serves one of those. Measure before optimizing; the bottleneck is rarely where it feels like it is. --- ## Measure first ```js performance.mark('render-start'); renderChart(data); performance.mark('render-end'); performance.measure('chart', 'render-start', 'render-end'); console.log(performance.getEntriesByName('chart')[0].duration.toFixed(1) + 'ms'); ``` Then use the browser's performance panel. The usual culprits, in the order they usually appear: 1. **Too much embedded data** parsed on load → `artifact-data-loading` 2. **Too many DOM nodes** → aggregate, paginate, or virtualize 3. **Per-element event listeners** → delegate 4. **Layout thrash** — reading and writing layout in a loop 5. **Re-rendering everything** when one region changed --- ## The element-count thresholds | Elements | Approach | |---|---| | < 1,000 | SVG, no special handling. Almost every finance chart lives here | | 1,000-5,000 | SVG, but delegate events and skip per-element transitions | | 5,000-50,000 | Canvas for the marks, SVG overlay for axes, labels, and interaction | | > 50,000 | Aggregate or bin. This is a data problem, not a rendering one | A bridge has 12 bars. A monthly series has 36 points. A cohort heatmap has 576 cells. **Reaching for canvas on a finance chart is almost alwa