Skip to content
Myr

seamless-immutable is much faster when mapping, changed MAX back to original value

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Pekeler · committed by Christian Pekeler · parent bb6a96e · Browse files · 1 file+13 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−10 removed

  • other:+13 added−10 removed

1 file+13 added−10 removed

modified:__performance_tests__/todo.js+13 added-10 removed
9 unmodified lines
10 return x11}1213describe("performance", () => {14 const MAX = 1000014 const MAX = 10000015 const MODIFY_FACTOR = 0.116 const baseState = []17 let frozenBazeState18 let immutableJsBaseState
126 unmodified lines
145 .toJS()146 })147148 measure("seamless-immutable", () => {149 let state = seamlessBaseState150 for (let i = 0; i < MAX * MODIFY_FACTOR; i++) {151 state = state.setIn([i, "done"], true)152 }149 const state = seamlessBaseState150 state.map((todo, index) => {151 if (index < MAX * MODIFY_FACTOR) return todo.set("done", true)152 else return todo153 })154 })155156 measure("seamless-immutable + asMutable", () => {156 let state = seamlessBaseState157 for (let i = 0; i < MAX * MODIFY_FACTOR; i++) {158 state = state.setIn([i, "done"], true)159 }160 state.asMutable({deep: true})157 const state = seamlessBaseState158 state159 .map((todo, index) => {160 if (index < MAX * MODIFY_FACTOR) return todo.set("done", true)161 else return todo162 })163 .asMutable({deep: true})164 })165166 measure("immer (proxy) - without autofreeze", () => {167 setUseProxies(true)
38 unmodified lines