@@ -133,7 +133,7 @@ const createMutativeReducer =
133
133
} ,
134
134
isMutativeAutoFreeze ? { enableAutoFreeze : true } : undefined
135
135
) ;
136
- const MAX_ITERATIONS = 1 ;
136
+ const MAX_ITERATIONS = 10 ;
137
137
138
138
Object . entries ( actions ) . forEach ( ( [ actionName , action ] ) => {
139
139
{
@@ -142,63 +142,78 @@ Object.entries(actions).forEach(([actionName, action]) => {
142
142
const immerReducer = createMutativeReducer ( produce ) ;
143
143
let next = immerReducer ( initialState , action ( 0 ) ) ;
144
144
console . timeEnd ( `[${ actionName } ]immer:autoFreeze` ) ;
145
- console . time ( `[${ actionName } ]immer:autoFreeze:nextAction` ) ;
145
+ console . time (
146
+ `[${ actionName } ]immer:autoFreeze:nextAction(${ MAX_ITERATIONS } )`
147
+ ) ;
146
148
for ( let i = 0 ; i < MAX_ITERATIONS ; i ++ ) {
147
149
next = immerReducer ( next , action ( i ) ) ;
148
150
}
149
- console . timeEnd ( `[${ actionName } ]immer:autoFreeze:nextAction` ) ;
151
+ console . timeEnd (
152
+ `[${ actionName } ]immer:autoFreeze:nextAction(${ MAX_ITERATIONS } )`
153
+ ) ;
150
154
}
151
- console . log ( '---------------------------------' ) ;
155
+ console . log ( '------------------------------------------------------- ' ) ;
152
156
{
153
157
const initialState = createInitialState ( ) ;
154
158
console . time ( `[${ actionName } ]mutative:autoFreeze` ) ;
155
159
const mutativeReducer = createMutativeReducer ( create , true ) ;
156
160
let next = mutativeReducer ( initialState , action ( 0 ) ) ;
157
161
console . timeEnd ( `[${ actionName } ]mutative:autoFreeze` ) ;
158
- console . time ( `[${ actionName } ]mutative:autoFreeze:nextAction` ) ;
162
+ console . time (
163
+ `[${ actionName } ]mutative:autoFreeze:nextAction(${ MAX_ITERATIONS } )`
164
+ ) ;
159
165
for ( let i = 0 ; i < MAX_ITERATIONS ; i ++ ) {
160
166
next = mutativeReducer ( next , action ( i ) ) ;
161
167
}
162
- console . timeEnd ( `[${ actionName } ]mutative:autoFreeze:nextAction` ) ;
168
+ console . timeEnd (
169
+ `[${ actionName } ]mutative:autoFreeze:nextAction(${ MAX_ITERATIONS } )`
170
+ ) ;
163
171
}
164
- console . log ( '---------------------------------' ) ;
172
+ console . log ( '------------------------------------------------------- ' ) ;
165
173
{
166
174
setAutoFreeze ( false ) ;
167
175
const initialState = createInitialState ( ) ;
168
176
console . time ( `[${ actionName } ]immer:noAutoFreeze` ) ;
169
177
const immerReducer = createMutativeReducer ( produce ) ;
170
178
let next = immerReducer ( initialState , action ( 0 ) ) ;
171
179
console . timeEnd ( `[${ actionName } ]immer:noAutoFreeze` ) ;
172
- console . time ( `[${ actionName } ]immer:noAutoFreeze:nextAction` ) ;
173
- for ( let i = 1 ; i < 2 ; i ++ ) {
180
+ console . time (
181
+ `[${ actionName } ]immer:noAutoFreeze:nextAction(${ MAX_ITERATIONS } )`
182
+ ) ;
183
+ for ( let i = 1 ; i < MAX_ITERATIONS ; i ++ ) {
174
184
immerReducer ( initialState , action ( i ) ) ;
175
185
}
176
- console . timeEnd ( `[${ actionName } ]immer:noAutoFreeze:nextAction` ) ;
186
+ console . timeEnd (
187
+ `[${ actionName } ]immer:noAutoFreeze:nextAction(${ MAX_ITERATIONS } )`
188
+ ) ;
177
189
}
178
- console . log ( '---------------------------------' ) ;
190
+ console . log ( '------------------------------------------------------- ' ) ;
179
191
{
180
192
const initialState = createInitialState ( ) ;
181
193
console . time ( `[${ actionName } ]mutative:noAutoFreeze` ) ;
182
194
const mutativeReducer = createMutativeReducer ( create ) ;
183
195
let next = mutativeReducer ( initialState , action ( 0 ) ) ;
184
196
console . timeEnd ( `[${ actionName } ]mutative:noAutoFreeze` ) ;
185
- console . time ( `[${ actionName } ]mutative:noAutoFreeze:nextAction` ) ;
197
+ console . time (
198
+ `[${ actionName } ]mutative:noAutoFreeze:nextAction(${ MAX_ITERATIONS } )`
199
+ ) ;
186
200
for ( let i = 0 ; i < MAX_ITERATIONS ; i ++ ) {
187
201
next = mutativeReducer ( next , action ( i ) ) ;
188
202
}
189
- console . timeEnd ( `[${ actionName } ]mutative:noAutoFreeze:nextAction` ) ;
203
+ console . timeEnd (
204
+ `[${ actionName } ]mutative:noAutoFreeze:nextAction(${ MAX_ITERATIONS } )`
205
+ ) ;
190
206
}
191
- console . log ( '---------------------------------' ) ;
207
+ console . log ( '------------------------------------------------------- ' ) ;
192
208
{
193
209
const initialState = createInitialState ( ) ;
194
210
console . time ( `[${ actionName } ]vanilla` ) ;
195
211
let next = vanillaReducer ( initialState , action ( 0 ) ) ;
196
212
console . timeEnd ( `[${ actionName } ]vanilla` ) ;
197
- console . time ( `[${ actionName } ]vanilla:nextAction` ) ;
213
+ console . time ( `[${ actionName } ]vanilla:nextAction( ${ MAX_ITERATIONS } ) ` ) ;
198
214
for ( let i = 0 ; i < MAX_ITERATIONS ; i ++ ) {
199
215
next = vanillaReducer ( next , action ( i ) ) ;
200
216
}
201
- console . timeEnd ( `[${ actionName } ]vanilla:nextAction` ) ;
217
+ console . timeEnd ( `[${ actionName } ]vanilla:nextAction( ${ MAX_ITERATIONS } ) ` ) ;
202
218
}
203
- console . log ( '=================================' ) ;
204
219
} ) ;
0 commit comments