Hacker News new | ask | show | jobs
by njtransit 655 days ago
I have a relatively naive implementation of an infinite canvas in React (which is a very slow library). The implementation is exactly 161 lines of code (including white space, imports, etc.). On my laptop, my implementation visibly starts to drop frames around 10,000 elements. The linked implementation starts to visibly drop frames at 20,000 elements. I'm leaving a lot of performance on the table, e.g. I don't have a culling equivalent and my DOM structure causes hit testing to be the bottleneck, which is solvable. What I'm able to render is much richer than a canvas, because of full HTML/CSS support. It's definitely possible, but you have to be willing to sit down with the profiler to understand what your bottlenecks are.