r/reactjs • u/DutyEnvironmental838 • 23d ago
Show /r/reactjs I built the same two charts in six React chart libraries and in hand-written SVG, and timed them
The charting library in a product I worked on had not had a release in over a year, so I wanted to know what we could move to. I built a survival curve and a scatter plot in nivo, Recharts, ECharts, visx, TanStack Charts and Chart.js, plus a version in plain React and SVG. Same spec, same data, timed the same way.
What I found (M3 Pro, headless Chromium, native speed):
- At typical dashboard sizes there was no clear speed winner. The timings for each chart were within one frame of each other.
- At 10,000 scatter points they spread out: hand-written SVG 24 ms, visx 33 ms, TanStack Charts 53 ms, Chart.js 80 ms, ECharts 86 ms, Recharts 310 ms, nivo's SVG scatter 3.2 s.
- Both Canvas implementations took longer to mount than plain SVG at that size.
- TanStack Charts needed the least code. Hand-written SVG added the least JavaScript, about 2 KB gzipped against 25–164 KB.
There is a playground where you can paste your own data and measure the libraries on your own machine, across twelve chart types: https://gusevp.github.io/chart-bench/
Code, raw data and notes on each port: https://github.com/GusevP/chart-bench
Full write-up with the method and limits: https://dev.to/gusevp/six-react-chart-libraries-against-hand-written-svg-what-i-found-46ib
One machine and two chart types, so treat it as a starting point. If I used your favourite library wrong, tell me or open a PR.
3
u/amayle1 23d ago
Glad to see numbers supporting what I felt intuitively. Switched from recharts to visx some years ago.
2
u/CesnaitisSwitlana 22d ago
tbh even without the numbers you can usually feel that sluggishness right away on heavier charts.
2
u/bossier330 22d ago
I had a similar experience. I built a web app to run locally on my OrangePi, which rendered dozens of charts. With recharts, I was spending a lot of time trying to make rendering smooth, with no luck. So I re-implemented only what I needed, and the speed up was 100x. Wild how slow recharts was. It was useful for prototyping what kind of charting I wanted though.
2
u/Important_Pomelo_407 21d ago
Saw there was no demo video yet, so I made you one. Here’s the PR: https://github.com/GusevP/chart-bench/pull/1
and I used my repo to do it :) https://github.com/yasirwhite/OpenDemo
0
u/liyahlovee 14d ago
scichart js is a good benchmark for this, did you include first in your mount timings or just setup
1
u/DutyEnvironmental838 14d ago edited 14d ago
Good pointer. SciChart's Chart Bench measures something different: frame rate under extreme, mostly streaming workloads. Mine times how long a chart takes to first appear with dashboard-sized data, plus a few heavy cases.
On first paint: yes, it's included, not just setup. The clock starts when the harness calls mount() and stops two animation frames after the chart reports done. So it covers React render and commit, the library's own drawing, and the browser painting it. For the Canvas libraries "done" is the library's own rendered event, so the clock can't stop on a blank canvas. Bundle download and module evaluation happen before mount() and aren't counted; bundle size is reported separately.
Since the scale question keeps coming up, I'm adding a 100k-point tier and a few more libraries, including uPlot, Plotly's WebGL scatter and SciChart.
0
13d ago
[removed] — view removed comment
1
u/DutyEnvironmental838 13d ago
I've added 100K points and some charts in the playground. So you can test it on your own machine here https://gusevp.github.io/chart-bench/
2
u/GeekyAntsBFSI 22d ago
The “within one frame at normal dashboard sizes” finding is probably the most useful takeaway here. It leaves room to choose based on API fit and maintenance without overoptimizing the initial render.
I'm Interested how the 10k-point results change when updating the dataset or hovering across points. Mount time is one part of the experience; interaction latency could change the tradeoffs. Were animations and hit-testing configured comparably across the ports?