Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
344 stars 7 forks source link

refactor: micro-optimize store and graph operations #60

Closed bowheart closed 1 year ago

bowheart commented 1 year ago

Description

Use maps instead of objects for tracking graph dependencies and dependents. These are much faster to iterate over according to this benchmark. Some local testing shows that these changes increase speed by up to 4x in some cases.

Also set the store._isSolo property instead of deriving it for a tiny speed gain. Also set the instance._isEvaluating property instead of deriving it from the evaluation stack for even more tiny speed gains.

Also improve bundle size a little bit.

Affects

atoms, core, immer, machines, react