Skip to content

Commit

Permalink
modify immer metrics to scan 5000 index
Browse files Browse the repository at this point in the history
  • Loading branch information
rstachof committed Jan 10, 2025
1 parent d29c0a8 commit fc1abf6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions immutability-benchmarks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {produce as produce7, setAutoFreeze as setAutoFreeze7} from "immer7"
import {produce as produce8, setAutoFreeze as setAutoFreeze8} from "immer8"
import {produce as produce9, setAutoFreeze as setAutoFreeze9} from "immer9"
import {produce as produce10, setAutoFreeze as setAutoFreeze10} from "immer10"
import {produce as produce10Each, setAutoFreeze as setAutoFreeze10Each} from "immer10Each"
import {create as produceMutative} from "mutative";
import {produce as produceMutativeCompat, setAutoFreeze as setAutoFreezeMutativeCompat} from "mutative-compat";
import {bench, run, group, summary} from "mitata"
Expand Down Expand Up @@ -63,7 +62,6 @@ const immerProducers = {
// immer8: produce8,
immer9: produce9,
immer10: produce10,
immer10Each: produce10Each,
mutative: produceMutative,
mutativeCompat: produceMutativeCompat
}
Expand All @@ -76,7 +74,6 @@ const setAutoFreezes = {
// immer8: setAutoFreeze8,
immer9: setAutoFreeze9,
immer10: setAutoFreeze10,
immer10Each: setAutoFreeze10Each,
mutative: () => {},
mutativeCompat: setAutoFreezeMutativeCompat
}
Expand Down Expand Up @@ -133,6 +130,7 @@ const createImmerReducer = (produce) => {
break
case "test/removeItem":
draft.largeArray.splice(action.payload, 1)

break
case "test/updateItem": {
const item = draft.largeArray.find(
Expand Down Expand Up @@ -181,7 +179,7 @@ function createBenchmarks() {
function benchMethod() {
setAutoFreezes[version](freeze)
for (let i = 0; i < MAX; i++) {
reducers[version](initialState, actions[action](i))
reducers[version](initialState, actions[action](5000))
}
setAutoFreezes[version](false)
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"cross-env": "^7.0.3",
"immer": "^10.1.1",
"immer10": "npm:immer@10",
"immer10Each": "file:.yalc/immer",
"immer5": "npm:immer@5",
"immer6": "npm:immer@6",
"immer7": "npm:immer@7",
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fc1abf6

Please sign in to comment.