Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

React slower than Direct update? #15

Open
jflayhart opened this issue Dec 19, 2016 · 4 comments
Open

React slower than Direct update? #15

jflayhart opened this issue Dec 19, 2016 · 4 comments

Comments

@jflayhart
Copy link

jflayhart commented Dec 19, 2016

Guess I am confused and maybe misinformed, but how is http://toxicfork.github.io/react-three-renderer-example/#/benchmarks_rotating_cubes_react slower (considerably less FPS running at 3000 cubes) than the direct update example? I am assuming "direct update" means manipulating the DOM directly instead of leveraging React's virtual DOM (which I figured would be more performant)?

@jflayhart
Copy link
Author

jflayhart commented Dec 19, 2016

Well, it's probably more like I am confused, but what is direct update doing exactly? Just the difference between directly extending the cube component vs running the ExampleBase component? Because it seems both examples are using React, so my initial assumption of what "direct" meant seems to be wrong.

@eexe1
Copy link

eexe1 commented Apr 10, 2017

From the direct update js, its updateGraphic function is different. It updates the DOM directly.

@toxicFork
Copy link
Collaborator

toxicFork commented Apr 10, 2017

I had sent an email response but it seems github had missed it... Direct updates version uses react only to build the scene for the initial render, but for the updates it modifies the objects without going through React, which will be faster without doubt. Once react becomes even more performant we will see the gap decrease, but there may always be some sort of overhead for cases like these.

@toxicFork
Copy link
Collaborator

And instead of the dom it's threejs objects :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants