dillon1000/react

Commit

Increase speed of shallowEqual

All testes successfully completed.

- for-in in browsers is slow, i replaced him by Object.keys + for(array)
- simple check of lengths let us not iterate if not same
- now we dont need to test for B's keys missing from A, because if length's is same and prev check success - objB hasn't more keys
- micro optimize: calling objB.hasOwnProperty
- micro optimize: replaced !objA || !obj for more speedy check === null

#inspiredby https://github.com/jurassix/react-immutable-render-mixin/pull/4
Browse files
Changed paths1 file
First-parent comparison
M src/utils/shallowEqual.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…