Skip to content

Commit 58287c7

Browse files
committed
update CHANGELOG and README with valid data
1 parent 78654fc commit 58287c7

File tree

2 files changed

+69
-43
lines changed

2 files changed

+69
-43
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# micro-memoize CHANGELOG
22

3+
## 5.0.0
4+
5+
**Smaller, faster, with more features**
6+
7+
This is a complete rewrite of the library that improves bundle size and runtime performance while also offering more features. If you are using the simple use case of `memoize(fn)` then you should have no impact. However, if you were making use of specific options, you will be impacted.
8+
9+
### Breaking changes
10+
11+
- `isPromise` has been renamed to `async`, to more clearly identify the type of function it is vs what the result of calling it will be
12+
- `isEqual` has been renamed to `isArgEqual`, for better clarity vs `isMatchingKey`
13+
- `isMatchingKey` has been renamed to `isKeyEqual`, for better clarity vs `isEqual`
14+
- `onCacheAdd` / `onCacheChange` / `onCacheHit` has been rearchitected entirely into a dynamic event listener on the `memoized.cache` namespace
15+
- `memoized.cache.snapshot` has renamed to `memoized.cache.entries()` to align with common conventions of `Map`
16+
- Returns an array of `[Key, value]` pairs instead of `{keys: Key[], size: number, values: any[]}` to align with common JS conventions and allow direct population of `Map` / `WeakMap`
17+
- `memoized.options` is now a transparent pass-through of the options provided, instead storing the normalized version
18+
19+
### Enhancements
20+
21+
- Speed improvements
22+
- Reduction in bundle size
23+
- Cache manipulation is easier with added methods:
24+
- `memoized.cache.delete(key)`
25+
- `memoized.cache.get(key)`
26+
- `memoized.cache.has(key)`
27+
- `memoized.cache.set(key, value)`
28+
329
## 4.1.2
430

531
- Republish of [#102](https://github.com/planttheidea/micro-memoize/pull/102)

README.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ A tiny, crazy [fast](#benchmarks) memoization library for the 95% use-case
1212
- [Composition](#composition)
1313
- [Options](#options)
1414
- [async](#async)
15-
- [isArgEqual](#matchesarg)
16-
- [isKeyEqual](#matcheskey)
15+
- [isArgEqual](#isargequal)
16+
- [isKeyEqual](#iskeyequal)
1717
- [maxSize](#maxsize)
1818
- [transformKey](#transformkey)
1919
- [Cache](#cache)
@@ -505,7 +505,7 @@ The [`options`](#options) passed when creating the memoized method.
505505

506506
All values provided are the number of operations per second (ops/sec) calculated by the [Benchmark suite](https://benchmarkjs.com/). Note that `underscore`, `lodash`, and `ramda` do not support mulitple-parameter memoization (which is where `micro-memoize` really shines), so they are not included in those benchmarks.
507507

508-
Benchmarks was performed on an i7 8-core Arch Linux laptop with 16GB of memory using NodeJS version `10.15.0`. The default configuration of each library was tested with a fibonacci calculation based on the following parameters:
508+
Benchmarks was performed on an i9 16-core Arch Linux laptop with 64GB of memory using NodeJS version `18.19.0`. The default configuration of each library was tested with a fibonacci calculation based on the following parameters:
509509

510510
- Single primitive = `35`
511511
- Single object = `{number: 35}`
@@ -520,67 +520,67 @@ This is usually what benchmarks target for ... its the least-likely use-case, bu
520520

521521
| | Operations / second |
522522
| ----------------- | ------------------- |
523-
| fast-memoize | 59,069,204 |
524-
| **micro-memoize** | **48,267,295** |
525-
| lru-memoize | 46,781,143 |
526-
| Addy Osmani | 32,372,414 |
527-
| lodash | 29,297,916 |
528-
| ramda | 25,054,838 |
529-
| mem | 24,848,072 |
530-
| underscore | 24,847,818 |
531-
| memoizee | 18,272,987 |
532-
| memoizerific | 7,302,835 |
523+
| **micro-memoize** | **121,740,174** |
524+
| fast-memoize | 110,892,952 |
525+
| mem | 104,487,931 |
526+
| lru-memoize | 103,134,780 |
527+
| Addy Osmani | 71,287,174 |
528+
| underscore | 60,782,053 |
529+
| lodash | 56,091,762 |
530+
| ramda | 49,892,367 |
531+
| memoizee | 47,142,953 |
532+
| memoizerific | 18,708,398 |
533533

534534
### Single parameter (complex object)
535535

536536
This is what most memoization libraries target as the primary use-case, as it removes the complexities of multiple arguments but allows for usage with one to many values.
537537

538538
| | Operations / second |
539539
| ----------------- | ------------------- |
540-
| **micro-memoize** | **40,360,621** |
541-
| lodash | 30,862,028 |
542-
| lru-memoize | 25,740,572 |
543-
| memoizee | 12,058,375 |
544-
| memoizerific | 6,854,855 |
545-
| ramda | 2,287,030 |
546-
| underscore | 2,270,574 |
547-
| Addy Osmani | 2,076,031 |
548-
| mem | 2,001,984 |
549-
| fast-memoize | 1,591,019 |
540+
| **micro-memoize** | **59,189,580** |
541+
| lodash | 53,370,488 |
542+
| lru-memoize | 43,956,168 |
543+
| memoizee | 27,109,412 |
544+
| memoizerific | 16,657,400 |
545+
| ramda | 4,831,034 |
546+
| underscore | 4,596,231 |
547+
| mem | 4,159,677 |
548+
| Addy Osmani | 3,931,473 |
549+
| fast-memoize | 2,390,688 |
550550

551551
### Multiple parameters (primitives only)
552552

553553
This is a very common use-case for function calls, but can be more difficult to optimize because you need to account for multiple possibilities ... did the number of arguments change, are there default arguments, etc.
554554

555555
| | Operations / second |
556556
| ----------------- | ------------------- |
557-
| **micro-memoize** | **33,546,353** |
558-
| lru-memoize | 20,884,669 |
559-
| memoizee | 7,831,161 |
560-
| Addy Osmani | 6,447,448 |
561-
| memoizerific | 5,587,779 |
562-
| mem | 2,620,943 |
563-
| underscore | 1,617,687 |
564-
| ramda | 1,569,167 |
565-
| lodash | 1,512,515 |
566-
| fast-memoize | 1,376,665 |
557+
| **micro-memoize** | **47,199,467** |
558+
| lru-memoize | 39,757,821 |
559+
| memoizee | 17,539,760 |
560+
| memoizerific | 11,917,711 |
561+
| Addy Osmani | 9,495,702 |
562+
| mem | 6.334.600 |
563+
| ramda | 2,408,712 |
564+
| underscore | 2,359,704 |
565+
| fast-memoize | 2,173,298 |
566+
| lodash | 2,148,902 |
567567

568568
### Multiple parameters (complex objects)
569569

570570
This is the most robust use-case, with the same complexities as multiple primitives but managing bulkier objects with additional edge scenarios (destructured with defaults, for example).
571571

572572
| | Operations / second |
573573
| ----------------- | ------------------- |
574-
| **micro-memoize** | **34,857,438** |
575-
| lru-memoize | 20,838,330 |
576-
| memoizee | 7,820,066 |
577-
| memoizerific | 5,761,357 |
578-
| mem | 1,184,550 |
579-
| ramda | 1,034,937 |
580-
| underscore | 1,021,480 |
581-
| Addy Osmani | 1,014,642 |
582-
| lodash | 1,014,060 |
583-
| fast-memoize | 949,213 |
574+
| **micro-memoize** | **44,516,544** |
575+
| lru-memoize | 40,112,503 |
576+
| memoizee | 17,190,427 |
577+
| memoizerific | 12,216,818 |
578+
| Addy Osmani | 2,163,630 |
579+
| mem | 2,136,207 |
580+
| underscore | 1,427,046 |
581+
| ramda | 1,414,979 |
582+
| lodash | 1,349,489 |
583+
| fast-memoize | 1,246,579 |
584584

585585
## Browser support
586586

0 commit comments

Comments
 (0)