nteract / semiotic

A data visualization framework combining React & D3
https://semioticv1.nteract.io/
Other
2.43k stars 132 forks source link

Quick optimizations to avoid excessive GC cycles #622

Closed alexeyraspopov closed 2 years ago

alexeyraspopov commented 2 years ago

There are some charts I'm testing this stuff on, and I'm seeing some significant boost for OrdinalFrame simply by reducing the amount of GC cycles the browser need to get through:

https://github.com/nteract/semiotic/commit/bd1dae92b46b570f0d6805192553a8f4060032f1 Pretty basic, not really that significant, but may be good to have for some edge cases where the array to sum is quite long.

https://github.com/nteract/semiotic/commit/f6dd89d61b86cae64402f7b79262408494a9874b This one is quite huge, it boosts barLayout() at least x3 on what I've tested it for. Making small slices via map and then adding them to the rest of items (both via spread and concat) producing too many GC cycles to free up the memory allocated for the map. Instead, we can push all the values directly to the resulting array.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nteract/semiotic/9HygoLykhB8srjmYeqB8KrX2sz1Y
✅ Preview: https://semiotic-git-quickoptimizations-nteract.vercel.app