Skip to content

Commit

Permalink
docs(benchmark): update benchmark for mutative v1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Sep 17, 2024
1 parent a38f0dc commit 556e0b1
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,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.5 vs Immer v10.1.1]
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.9 vs Immer v10.1.1]

![Benchmark](benchmark.jpg)

```
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.38% (95 runs sampled)
Mutative - No Freeze x 6,199 ops/sec ±0.79% (89 runs sampled)
Immer - No Freeze x 5.30 ops/sec ±0.38% (18 runs sampled)
Naive handcrafted reducer - No Freeze x 4,447 ops/sec ±0.85% (96 runs sampled)
Mutative - No Freeze x 6,246 ops/sec ±1.29% (92 runs sampled)
Immer - No Freeze x 5.26 ops/sec ±0.56% (18 runs sampled)
Mutative - Freeze x 974 ops/sec ±1.77% (92 runs sampled)
Immer - Freeze x 376 ops/sec ±0.67% (92 runs sampled)
Mutative - Freeze x 950 ops/sec ±0.95% (96 runs sampled)
Immer - Freeze x 377 ops/sec ±0.37% (93 runs sampled)
Mutative - Patches and No Freeze x 969 ops/sec ±0.99% (97 runs sampled)
Immer - Patches and No Freeze x 5.27 ops/sec ±0.36% (18 runs sampled)
Mutative - Patches and No Freeze x 978 ops/sec ±0.16% (97 runs sampled)
Immer - Patches and No Freeze x 5.23 ops/sec ±0.25% (18 runs sampled)
Mutative - Patches and Freeze x 514 ops/sec ±0.97% (95 runs sampled)
Immer - Patches and Freeze x 275 ops/sec ±0.74% (89 runs sampled)
Mutative - Patches and Freeze x 504 ops/sec ±1.01% (94 runs sampled)
Immer - Patches and Freeze x 272 ops/sec ±0.83% (89 runs sampled)
The fastest method is Mutative - No Freeze
```
Expand All @@ -137,7 +137,7 @@ Run `yarn benchmark` to measure performance.
Immer relies on auto-freeze to be enabled, if auto-freeze is disabled, Immer will have a huge performance drop and Mutative will have a huge performance lead, especially with large data structures it will have a performance lead of more than 50x.

So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,199 ops/sec`) and Immer (`376 ops/sec`).
So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,246 ops/sec`) and Immer (`377 ops/sec`).

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.

Expand Down
Binary file modified benchmark-array.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark-class.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark-object.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified benchmark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions website/blog/releases/1.0/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5 vs Immer v10.1.1]
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.9 vs Immer v10.1.1]

![Benchmark](img/benchmark.jpg)

```
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.38% (95 runs sampled)
Mutative - No Freeze x 6,199 ops/sec ±0.79% (89 runs sampled)
Immer - No Freeze x 5.30 ops/sec ±0.38% (18 runs sampled)
Naive handcrafted reducer - No Freeze x 4,447 ops/sec ±0.85% (96 runs sampled)
Mutative - No Freeze x 6,246 ops/sec ±1.29% (92 runs sampled)
Immer - No Freeze x 5.26 ops/sec ±0.56% (18 runs sampled)
Mutative - Freeze x 974 ops/sec ±1.77% (92 runs sampled)
Immer - Freeze x 376 ops/sec ±0.67% (92 runs sampled)
Mutative - Freeze x 950 ops/sec ±0.95% (96 runs sampled)
Immer - Freeze x 377 ops/sec ±0.37% (93 runs sampled)
Mutative - Patches and No Freeze x 969 ops/sec ±0.99% (97 runs sampled)
Immer - Patches and No Freeze x 5.27 ops/sec ±0.36% (18 runs sampled)
Mutative - Patches and No Freeze x 978 ops/sec ±0.16% (97 runs sampled)
Immer - Patches and No Freeze x 5.23 ops/sec ±0.25% (18 runs sampled)
Mutative - Patches and Freeze x 514 ops/sec ±0.97% (95 runs sampled)
Immer - Patches and Freeze x 275 ops/sec ±0.74% (89 runs sampled)
Mutative - Patches and Freeze x 504 ops/sec ±1.01% (94 runs sampled)
Immer - Patches and Freeze x 272 ops/sec ±0.83% (89 runs sampled)
The fastest method is Mutative - No Freeze
```
Expand All @@ -108,7 +108,7 @@ Run `yarn benchmark` to measure performance.
Immer relies on auto-freeze to be enabled, if auto-freeze is disabled, Immer will have a huge performance drop and Mutative will have a huge performance lead, especially with large data structures it will have a performance lead of more than 50x.

So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,199 ops/sec`) and Immer (`376 ops/sec`).
So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,246 ops/sec`) and Immer (`377 ops/sec`).

Overall, Mutative has a huge performance lead over Immer in [more performance testing scenarios](https://github.com/unadlib/mutative/tree/main/test/performance).

Expand Down
22 changes: 11 additions & 11 deletions website/docs/extra-topics/comparison-with-immer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5 vs Immer v10.1.1]
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.9 vs Immer v10.1.1]

![Benchmark](img/benchmark.jpg)

```
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.38% (95 runs sampled)
Mutative - No Freeze x 6,199 ops/sec ±0.79% (89 runs sampled)
Immer - No Freeze x 5.30 ops/sec ±0.38% (18 runs sampled)
Naive handcrafted reducer - No Freeze x 4,447 ops/sec ±0.85% (96 runs sampled)
Mutative - No Freeze x 6,246 ops/sec ±1.29% (92 runs sampled)
Immer - No Freeze x 5.26 ops/sec ±0.56% (18 runs sampled)
Mutative - Freeze x 974 ops/sec ±1.77% (92 runs sampled)
Immer - Freeze x 376 ops/sec ±0.67% (92 runs sampled)
Mutative - Freeze x 950 ops/sec ±0.95% (96 runs sampled)
Immer - Freeze x 377 ops/sec ±0.37% (93 runs sampled)
Mutative - Patches and No Freeze x 969 ops/sec ±0.99% (97 runs sampled)
Immer - Patches and No Freeze x 5.27 ops/sec ±0.36% (18 runs sampled)
Mutative - Patches and No Freeze x 978 ops/sec ±0.16% (97 runs sampled)
Immer - Patches and No Freeze x 5.23 ops/sec ±0.25% (18 runs sampled)
Mutative - Patches and Freeze x 514 ops/sec ±0.97% (95 runs sampled)
Immer - Patches and Freeze x 275 ops/sec ±0.74% (89 runs sampled)
Mutative - Patches and Freeze x 504 ops/sec ±1.01% (94 runs sampled)
Immer - Patches and Freeze x 272 ops/sec ±0.83% (89 runs sampled)
The fastest method is Mutative - No Freeze
```
Expand All @@ -52,7 +52,7 @@ Run `yarn benchmark` to measure performance.
Immer relies on auto-freeze to be enabled, if auto-freeze is disabled, Immer will have a huge performance drop and Mutative will have a huge performance lead, especially with large data structures it will have a performance lead of more than 50x.

So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,199 ops/sec`) and Immer (`376 ops/sec`).
So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,246 ops/sec`) and Immer (`377 ops/sec`).

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.

22 changes: 11 additions & 11 deletions website/docs/getting-started/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5 vs Immer v10.1.1]
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.9 vs Immer v10.1.1]

![Benchmark](img/benchmark.jpg)

```
Naive handcrafted reducer - No Freeze x 4,442 ops/sec ±0.38% (95 runs sampled)
Mutative - No Freeze x 6,199 ops/sec ±0.79% (89 runs sampled)
Immer - No Freeze x 5.30 ops/sec ±0.38% (18 runs sampled)
Naive handcrafted reducer - No Freeze x 4,447 ops/sec ±0.85% (96 runs sampled)
Mutative - No Freeze x 6,246 ops/sec ±1.29% (92 runs sampled)
Immer - No Freeze x 5.26 ops/sec ±0.56% (18 runs sampled)
Mutative - Freeze x 974 ops/sec ±1.77% (92 runs sampled)
Immer - Freeze x 376 ops/sec ±0.67% (92 runs sampled)
Mutative - Freeze x 950 ops/sec ±0.95% (96 runs sampled)
Immer - Freeze x 377 ops/sec ±0.37% (93 runs sampled)
Mutative - Patches and No Freeze x 969 ops/sec ±0.99% (97 runs sampled)
Immer - Patches and No Freeze x 5.27 ops/sec ±0.36% (18 runs sampled)
Mutative - Patches and No Freeze x 978 ops/sec ±0.16% (97 runs sampled)
Immer - Patches and No Freeze x 5.23 ops/sec ±0.25% (18 runs sampled)
Mutative - Patches and Freeze x 514 ops/sec ±0.97% (95 runs sampled)
Immer - Patches and Freeze x 275 ops/sec ±0.74% (89 runs sampled)
Mutative - Patches and Freeze x 504 ops/sec ±1.01% (94 runs sampled)
Immer - Patches and Freeze x 272 ops/sec ±0.83% (89 runs sampled)
The fastest method is Mutative - No Freeze
```
Expand All @@ -96,7 +96,7 @@ Run `yarn benchmark` to measure performance.
Immer relies on auto-freeze to be enabled, if auto-freeze is disabled, Immer will have a huge performance drop and Mutative will have a huge performance lead, especially with large data structures it will have a performance lead of more than 50x.

So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,199 ops/sec`) and Immer (`376 ops/sec`).
So if you are using Immer, you will have to enable auto-freeze for performance. Mutative is disabled auto-freeze by default. With the default configuration of both, we can see the 16x performance gap between Mutative (`6,246 ops/sec`) and Immer (`377 ops/sec`).

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.

Expand Down

0 comments on commit 556e0b1

Please sign in to comment.