16ms delay between keypress and React updating (note: because of lodash's debounce(0) on notify)
16ms for React to render
65ms to recalculate styles (note: 3600 elements are effected), 4 ms for layout (root is the document), 12ms for layer tree, 4ms hit test, 10ms update layer tree, 10ms paint (painting the .rg-level element)
While idling (user not doing anything):
50% of free time is spent Rendering. ~20% of free time is spent painting. And then ~25% is spent in "Other", leaving almost no time in the main thread free. Looks like while idling, ~100 elements constantly need style recalculated (4ms, layout takes ~1.5ms (11 elements need layout), update layer tree takes ~5.5, paint takes ~2ms (and paints the whole document again).
Key takeaways
responding to keypress is time taken for game logic/game model to update. To improve this, we should actually modify the logic/modify how we're updating the game.
Looks like most of the time is spent on the simpleEntitiesReducer's EntityUpdate method (aka simply re-assigning the entity). This isn't probably because we're duplicating a ~200 element array, 200 times, so it's O(n^2)
styles are being recalculated for every element on the page. The map has 1800 elements (x2 is 3600) so every single tile is being hit for some reason, even though most of them don't change.
game shouldn't lag just walking about