fluxo-js / fluxo

Fluxo is a simple, lightweight (~300LOC) and dependency free data infrastructure lib based on Facebook Flux and Backbone.js. It's compatible with React.js, but you can use with whatever you want to the view/component layer.
15 stars 3 forks source link

Fluxo.ObjectStore#toJSON memoization #17

Closed samuelsimoes closed 8 years ago

samuelsimoes commented 8 years ago

This commit introduces memoization on toJSON if store wasn't changed.

This change is particularly good when you are using something like react pure render, since the first comparision to avoid unnecessary DOM diff is the identity comparision, which is much more faster than deep comparision, the second step.

It's also good because doesn't make unnecessary CPU usage generating a freshly new JSON with stringify/parse on every toJSON call.

sobrinho commented 8 years ago

:shipit: