Hacker News new | ask | show | jobs
by esperent 1937 days ago
I haven't followed r3f development for the last six months or so, but previously I tested a couple of examples that were available as both r3f and pure three.js. I tested them on my old, slow mobile - and there seemed to be a big difference, with r3f much slower. When I brought this up with the devs, they have waved it away saying it's because the demos were running in dev mode (or something similar). However, I haven't seen any genuine comparisons of performance in r3f vs three.js, so for now I'm erring on the side of caution and assuming it's slow. I don't know enough about react to create performance tests myself, unfortunately.
2 comments

You don't really need to err on the side of caution, you can just try some of the examples. The first example, https://i2160.csb.app/ runs well on my $120 3 year old Android phone. My instanced ducks example, https://os16k.csb.app/ only gets about 15fps but its doing more than most games or sites need albeit in a trivial way.

react-three-fiber isn't a magic bullet that will make all web 3D things fast. You still have to be sensible. It does make it much easier to prototype things though, and a lot of the time performance is great. And if it isn't then most of the code is quite straightforward to move to pure WebGL.

r3f does not have a performance overhead, it is literally zero. rendering is done in threejs purely, react only takes care of managing the scene. but it can, in situations where the app faces a lot of load, outperform three easily, because it is scheduled, just like a virtual list outperforms a generic list.