Skip to content

Commit 498f24e

Browse files
committed
docs(benchmark): update docs about benchmark
1 parent 854ce8c commit 498f24e

File tree

15 files changed

+49
-40
lines changed

15 files changed

+49
-40
lines changed

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,23 @@ Mutative is up to 6x faster than naive handcrafted reducer for updating immutabl
108108

109109
> Mutative passed all of Immer's test cases.
110110
111-
Measure(ops/sec) to update 50K arrays and 1K objects, bigger is better([view source](https://github.com/unadlib/mutative/blob/main/test/performance/benchmark.ts)). [Mutative v1.0.4 vs Immer v10.0.4]
111+
Measure(ops/sec) to update 50K arrays and 1K objects, bigger is better([view source](https://github.com/unadlib/mutative/blob/main/test/performance/benchmark.ts)). [Mutative v1.0.5 vs Immer v10.0.4]
112112

113113
![Benchmark](benchmark.jpg)
114114

115115
```
116-
Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled)
117-
Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled)
118-
Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled)
116+
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled)
117+
Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled)
118+
Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled)
119119
120-
Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled)
121-
Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled)
120+
Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled)
121+
Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled)
122122
123-
Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled)
124-
Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled)
123+
Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled)
124+
Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled)
125125
126-
Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled)
127-
Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled)
126+
Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled)
127+
Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled)
128128
129129
The fastest method is Mutative - No Freeze
130130
```
@@ -139,6 +139,15 @@ So if you are using Immer, you will have to enable auto-freeze for performance.
139139

140140
Overall, Mutative has a huge performance lead over Immer in [more performance testing scenarios](https://github.com/unadlib/mutative/tree/main/test/performance). Run `yarn performance` to get all the performance results locally.
141141

142+
<details>
143+
<summary><b>More Performance Testing Scenarios, Mutative is up to 2.5X-73.8X faster than Immer: </b></summary>
144+
145+
![Mutative vs Immer - All benchmark results by average multiplier](test/benchmark/results/all.jpg)
146+
147+
> [view source](https://github.com/unadlib/mutative/blob/main/test/benchmark).
148+
149+
</details>
150+
142151
## Features and Benefits
143152

144153
- **Mutation makes immutable updates** - Immutable data structures supporting objects, arrays, Sets and Maps.

benchmark-array.jpg

-2.14 KB
Loading

benchmark-class.jpg

22 Bytes
Loading

benchmark-object.jpg

-2 Bytes
Loading

benchmark.jpg

-773 Bytes
Loading
-2.14 KB
Loading
-2 Bytes
Loading
-773 Bytes
Loading

website/blog/releases/1.0/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,23 @@ const state = create(baseState, (draft) => {
8181

8282
> Mutative passed all of Immer's test cases.
8383
84-
Measure(ops/sec) to update 50K arrays and 1K objects, bigger is better([view source](https://github.com/unadlib/mutative/blob/main/test/performance/benchmark.ts)). [Mutative v1.0.4 vs Immer v10.0.4]
84+
Measure(ops/sec) to update 50K arrays and 1K objects, bigger is better([view source](https://github.com/unadlib/mutative/blob/main/test/performance/benchmark.ts)). [Mutative v1.0.5 vs Immer v10.0.4]
8585

8686
![Benchmark](img/benchmark.jpg)
8787

8888
```
89-
Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled)
90-
Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled)
91-
Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled)
89+
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled)
90+
Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled)
91+
Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled)
9292
93-
Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled)
94-
Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled)
93+
Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled)
94+
Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled)
9595
96-
Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled)
97-
Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled)
96+
Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled)
97+
Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled)
9898
99-
Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled)
100-
Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled)
99+
Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled)
100+
Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled)
101101
102102
The fastest method is Mutative - No Freeze
103103
```

website/docs/extra-topics/comparison-with-immer.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ Mutative has fewer bugs such as accidental draft escapes than Immer, [view detai
2525

2626
> Mutative passed all of Immer's test cases.
2727
28-
Measure(ops/sec) to update 50K arrays and 1K objects, bigger is better([view source](https://github.com/unadlib/mutative/blob/main/test/performance/benchmark.ts)). [Mutative v1.0.4 vs Immer v10.0.4]
28+
Measure(ops/sec) to update 50K arrays and 1K objects, bigger is better([view source](https://github.com/unadlib/mutative/blob/main/test/performance/benchmark.ts)). [Mutative v1.0.5 vs Immer v10.0.4]
2929

3030
![Benchmark](img/benchmark.jpg)
3131

3232
```
33-
Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled)
34-
Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled)
35-
Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled)
33+
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled)
34+
Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled)
35+
Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled)
3636
37-
Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled)
38-
Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled)
37+
Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled)
38+
Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled)
3939
40-
Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled)
41-
Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled)
40+
Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled)
41+
Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled)
4242
43-
Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled)
44-
Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled)
43+
Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled)
44+
Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled)
4545
4646
The fastest method is Mutative - No Freeze
4747
```

0 commit comments

Comments
 (0)