Skip to content

Commit

Permalink
📝 New benchmarks
Browse files Browse the repository at this point in the history
Ruby 3.3.5:
- memoist
- memery
  • Loading branch information
pboling committed Sep 17, 2024
1 parent b86978b commit 5699bd4
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,37 +114,38 @@ For more usage details, see our detailed [documentation](#documentation).

Benchmarks are run in GitHub Actions, and the tables below are updated with every code change. **Values >1.00x represent how much _slower_ each gem’s memoized value retrieval is than the latest commit of `MemoWise`**, according to [`benchmark-ips`](https://github.com/evanphx/benchmark-ips) (2.11.0).

Results using Ruby 3.3.2:

|Method arguments|`Dry::Core` (1.0.1)|`Memery` (alt_memery|`Memoist` (memoist3|
|--|--|--|--|
|`()` (none)|0.44x|10.91x|3.73x|
|`(a)`|0.87x|6.65x|14.31x|
|`(a, b)`|0.69x|4.80x|9.86x|
|`(a:)`|0.98x|10.12x|19.52x|
|`(a:, b:)`|0.71x|8.49x|17.15x|
|`(a, b:)`|0.70x|8.03x|13.98x|
|`(a, *args)`|0.80x|2.09x|3.62x|
|`(a:, **kwargs)`|0.63x|2.46x|6.36x|
|`(a, *args, b:, **kwargs)`|0.68x|1.69x|4.03x|
Results using Ruby 3.3.5:

| Method arguments | `alt_memery` (2.1.0) | `dry-core`\* (1.0.1) | `memery` (1.6.0) | `memoist` (1.0.0) | `memoist3` (1.0.0) |
|----------------------------|----------------------|----------------------|------------------|-------------------|--------------------|
| `()` (none) | 11.21x | 0.44x | 5.20x | 3.87x | 2.93x |
| `(a)` | 6.57x | 0.84x | 5.61x | 12.81x | 10.85x |
| `(a, b)` | 4.84x | 0.71x | 3.99x | 9.09x | 7.80x |
| `(a:)` | 9.48x | 0.84x | 6.26x | 16.16x | 15.49x |
| `(a:, b:)` | 7.70x | 0.73x | 4.99x | 15.85x | 15.87x |
| `(a, b:)` | 7.51x | 0.70x | 4.79x | 12.72x | 12.48x |
| `(a, *args)` | 2.11x | 0.82x | 1.59x | 4.01x | 3.91x |
| `(a:, **kwargs)` | 2.71x | 0.89x | 2.30x | 6.52x | 6.19x |
| `(a, *args, b:, **kwargs)` | 1.70x | 0.73x | 1.21x | 3.74x | 3.45x |

\* `Dry::Core`
[may cause incorrect behavior caused by hash collisions](https://github.com/dry-rb/dry-core/issues/63).

Results using Ruby 2.7.8 (either because these gems raise errors in Ruby 3.x,
or due to namespace collisions with more modern forks run against Ruby 3.x):

|Method arguments|`DDMemoize` (1.0.0)|`Memery` (memery|`Memoist` (memoist|`Memoized` (1.1.1)|`Memoizer` (1.0.3)|
|--|--|--|--|--|--|
|`()` (none)|20.10x|3.79x|2.35x|22.22x|3.05x|
|`(a)`|17.03x|8.70x|12.39x|17.75x|11.06x|
|`(a, b)`|15.26x|8.41x|11.13x|15.27x|10.06x|
|`(a:)`|22.28x|12.52x|18.17x|20.59x|16.45x|
|`(a:, b:)`|10.09x|5.77x|9.15x|10.83x|11.99x|
|`(a, b:)`|20.01x|11.25x|16.88x|18.26x|15.34x|
|`(a, *args)`|2.98x|1.56x|2.27x|3.04x|1.96x|
|`(a:, **kwargs)`|2.73x|1.55x|2.20x|2.49x|2.10x|
|`(a, *args, b:, **kwargs)`|2.16x|1.16x|1.85x|1.99x|1.74x|
| Method arguments | `ddmemoize` (1.0.0) | `memoist` (0.16.2) | `memoized` (1.1.1) | `memoizer` (1.0.3) |
|----------------------------|---------------------|--------------------|--------------------|--------------------|
| `()` (none) | 19.73x | 2.64x | 21.73x | 3.13x |
| `(a)` | 16.55x | 11.94x | 17.91x | 10.68x |
| `(a, b)` | 15.01x | 10.95x | 15.04x | 9.95x |
| `(a:)` | 21.64x | 17.26x | 19.64x | 16.09x |
| `(a:, b:)` | 19.35x | 16.27x | 17.72x | 15.39x |
| `(a, b:)` | 19.06x | 15.62x | 16.95x | 14.85x |
| `(a, *args)` | 2.99x | 2.22x | 3.10x | 1.95x |
| `(a:, **kwargs)` | 2.57x | 2.17x | 2.50x | 2.02x |
| `(a, *args, b:, **kwargs)` | 2.11x | 1.90x | 2.00x | 1.73x |


You can run benchmarks yourself with:

Expand Down

0 comments on commit 5699bd4

Please sign in to comment.