-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
The cache benchmarking has a few issues:
- It only benchmarks small integers as keys of the underlying cache. This is my primary issue with the benchmarking. In my experience, I use memoization to avoid processing large in memory data structures. If the memoization function stringifies the incoming argument everytime, the stringification cost is highly likely to outweigh the performance benefits of memoization.
Mapis ideal for caching based on an object argument because v8 and other engines assign a random ID to every object under the hood and checking if it is the same object is as simple as comparing two ints. The cache benchmarking code should test massive objects as arguments to the memoization function. - It does not model key deletion.
Mapis specifically designed with key deletion in mind whereas hidden classes on objects are not so well suited to this. Keys are likely to be added and deleted a lot in a memoized function so it's important to model this. - It does not model the potential non-local performance impacts of using objects. In v8 the "megamorphic" cache system can become overloaded by the number of hidden classes and deoptimize code. I'm no v8 expert but I know enough to beware of microbenchmarking.
marcinrogacki, Tidlo, technixp, jligeza2, arrizalamin and 2 more
Metadata
Metadata
Assignees
Labels
No labels