diff --git a/README.md b/README.md index a755e552..2c311b2a 100644 --- a/README.md +++ b/README.md @@ -108,23 +108,23 @@ Mutative is up to 6x faster than naive handcrafted reducer for updating immutabl > Mutative passed all of Immer's test cases. -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] +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] ![Benchmark](benchmark.jpg) ``` -Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled) -Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled) -Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled) +Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled) +Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled) +Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled) -Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled) -Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled) +Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled) +Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled) -Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled) -Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled) +Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled) +Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled) -Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled) -Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled) +Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled) +Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled) The fastest method is Mutative - No Freeze ``` @@ -139,6 +139,15 @@ So if you are using Immer, you will have to enable auto-freeze for performance. 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. +
+More Performance Testing Scenarios, Mutative is up to 2.5X-73.8X faster than Immer: + +![Mutative vs Immer - All benchmark results by average multiplier](test/benchmark/results/all.jpg) + +> [view source](https://github.com/unadlib/mutative/blob/main/test/benchmark). + +
+ ## Features and Benefits - **Mutation makes immutable updates** - Immutable data structures supporting objects, arrays, Sets and Maps. diff --git a/benchmark-array.jpg b/benchmark-array.jpg index 5d64cad8..3dccde35 100644 Binary files a/benchmark-array.jpg and b/benchmark-array.jpg differ diff --git a/benchmark-class.jpg b/benchmark-class.jpg index 4a82c8b1..28ef8ae0 100644 Binary files a/benchmark-class.jpg and b/benchmark-class.jpg differ diff --git a/benchmark-object.jpg b/benchmark-object.jpg index bc248ce9..6fb7a314 100644 Binary files a/benchmark-object.jpg and b/benchmark-object.jpg differ diff --git a/benchmark.jpg b/benchmark.jpg index 39cb3029..1788e8a0 100644 Binary files a/benchmark.jpg and b/benchmark.jpg differ diff --git a/website/blog/releases/1.0/img/benchmark-array.jpg b/website/blog/releases/1.0/img/benchmark-array.jpg index 5d64cad8..3dccde35 100644 Binary files a/website/blog/releases/1.0/img/benchmark-array.jpg and b/website/blog/releases/1.0/img/benchmark-array.jpg differ diff --git a/website/blog/releases/1.0/img/benchmark-object.jpg b/website/blog/releases/1.0/img/benchmark-object.jpg index bc248ce9..6fb7a314 100644 Binary files a/website/blog/releases/1.0/img/benchmark-object.jpg and b/website/blog/releases/1.0/img/benchmark-object.jpg differ diff --git a/website/blog/releases/1.0/img/benchmark.jpg b/website/blog/releases/1.0/img/benchmark.jpg index 39cb3029..1788e8a0 100644 Binary files a/website/blog/releases/1.0/img/benchmark.jpg and b/website/blog/releases/1.0/img/benchmark.jpg differ diff --git a/website/blog/releases/1.0/index.md b/website/blog/releases/1.0/index.md index d54c9c04..5759b31a 100644 --- a/website/blog/releases/1.0/index.md +++ b/website/blog/releases/1.0/index.md @@ -81,23 +81,23 @@ const state = create(baseState, (draft) => { > Mutative passed all of Immer's test cases. -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] +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] ![Benchmark](img/benchmark.jpg) ``` -Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled) -Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled) -Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled) +Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled) +Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled) +Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled) -Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled) -Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled) +Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled) +Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled) -Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled) -Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled) +Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled) +Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled) -Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled) -Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled) +Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled) +Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled) The fastest method is Mutative - No Freeze ``` diff --git a/website/docs/extra-topics/comparison-with-immer.md b/website/docs/extra-topics/comparison-with-immer.md index e312cac3..d003720c 100644 --- a/website/docs/extra-topics/comparison-with-immer.md +++ b/website/docs/extra-topics/comparison-with-immer.md @@ -25,23 +25,23 @@ Mutative has fewer bugs such as accidental draft escapes than Immer, [view detai > Mutative passed all of Immer's test cases. -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] +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] ![Benchmark](img/benchmark.jpg) ``` -Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled) -Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled) -Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled) +Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled) +Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled) +Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled) -Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled) -Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled) +Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled) +Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled) -Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled) -Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled) +Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled) +Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled) -Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled) -Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled) +Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled) +Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled) The fastest method is Mutative - No Freeze ``` diff --git a/website/docs/extra-topics/img/benchmark.jpg b/website/docs/extra-topics/img/benchmark.jpg index 39cb3029..1788e8a0 100644 Binary files a/website/docs/extra-topics/img/benchmark.jpg and b/website/docs/extra-topics/img/benchmark.jpg differ diff --git a/website/docs/getting-started/img/benchmark-array.jpg b/website/docs/getting-started/img/benchmark-array.jpg index 5d64cad8..3dccde35 100644 Binary files a/website/docs/getting-started/img/benchmark-array.jpg and b/website/docs/getting-started/img/benchmark-array.jpg differ diff --git a/website/docs/getting-started/img/benchmark-object.jpg b/website/docs/getting-started/img/benchmark-object.jpg index bc248ce9..6fb7a314 100644 Binary files a/website/docs/getting-started/img/benchmark-object.jpg and b/website/docs/getting-started/img/benchmark-object.jpg differ diff --git a/website/docs/getting-started/img/benchmark.jpg b/website/docs/getting-started/img/benchmark.jpg index 39cb3029..1788e8a0 100644 Binary files a/website/docs/getting-started/img/benchmark.jpg and b/website/docs/getting-started/img/benchmark.jpg differ diff --git a/website/docs/getting-started/performance.md b/website/docs/getting-started/performance.md index 16bde7f8..ffb14065 100644 --- a/website/docs/getting-started/performance.md +++ b/website/docs/getting-started/performance.md @@ -69,23 +69,23 @@ const state = create(baseState, (draft) => { > Mutative passed all of Immer's test cases. -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] +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] ![Benchmark](img/benchmark.jpg) ``` -Naive handcrafted reducer - No Freeze x 4,450 ops/sec ±0.36% (96 runs sampled) -Mutative - No Freeze x 6,137 ops/sec ±1.15% (89 runs sampled) -Immer - No Freeze x 5.27 ops/sec ±0.65% (18 runs sampled) +Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.49% (94 runs sampled) +Mutative - No Freeze x 6,101 ops/sec ±1.26% (88 runs sampled) +Immer - No Freeze x 5.20 ops/sec ±0.68% (17 runs sampled) -Mutative - Freeze x 960 ops/sec ±1.42% (95 runs sampled) -Immer - Freeze x 378 ops/sec ±0.70% (93 runs sampled) +Mutative - Freeze x 946 ops/sec ±1.36% (92 runs sampled) +Immer - Freeze x 376 ops/sec ±1.10% (93 runs sampled) -Mutative - Patches and No Freeze x 960 ops/sec ±1.32% (97 runs sampled) -Immer - Patches and No Freeze x 5.27 ops/sec ±0.69% (18 runs sampled) +Mutative - Patches and No Freeze x 963 ops/sec ±1.14% (96 runs sampled) +Immer - Patches and No Freeze x 5.32 ops/sec ±0.21% (18 runs sampled) -Mutative - Patches and Freeze x 493 ops/sec ±1.40% (94 runs sampled) -Immer - Patches and Freeze x 275 ops/sec ±0.62% (89 runs sampled) +Mutative - Patches and Freeze x 501 ops/sec ±1.24% (93 runs sampled) +Immer - Patches and Freeze x 272 ops/sec ±0.61% (88 runs sampled) The fastest method is Mutative - No Freeze ```