r/reactjs • u/DutyEnvironmental838 • 16d 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.
2
u/GeekyAntsBFSI 15d 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?
3
u/amayle1 16d ago
Glad to see numbers supporting what I felt intuitively. Switched from recharts to visx some years ago.
2
u/bossier330 15d 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 14d 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 7d ago
scichart js is a good benchmark for this, did you include first in your mount timings or just setup
0
u/[deleted] 6d ago
[removed] — view removed comment