4 ms·
Yep, the test is considering all the calls to get() and getIn() as part of the React render overhead but these methods are much slower than accessing properties
by guscost 10y ago
Yep, the test is considering all the calls to get() and getIn() as part of the React render overhead but these methods are much slower than accessing properties directly. Running a comparison after removing the ImmutableJS state and adding version tags to the players (the game object can use its "clock" as a version), the production React implementation seems about twice as fast (1518 ms for React, 3377 ms for Vue, not at all scientific though).
Here's the implementation without ImmutableJS:
https://github.com/guscost/VueReactPerf https://github.com/guscost/VueReactPerf
Note: Using version tags with shouldComponentUpdate is a great way to optimize for speed, but then you're responsible for updating all your versions manually. If you forget one, the component will "freeze" and you may spend some time tracking down the problem. Just a friendly reminder that immutable data and unoptimized components are both better in this respect.
- guscost 10y agoOK on a different computer I'm seeing 768 ms for React and 398 ms for Vue. Maybe I got the tests backwards before. Or maybe there is that much variability. I'll have to check again.