You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following storage strategies exist and are used from the `Stack`
implementation:
* `ListCache`
* `Hash`
* `MapCache`
`ListCache`
===========
This is the initial storage mechanism. The underlying data format
is as follows:
```js
[
[key, value]
[key, value]
[key, value]
[key, value]
]
```
`Hash`
======
The underlying data format is as follows:
```js
{
[key]: value
}
```
The base object is an `EmptyObject` (roughly `Object.create(null)`).
`MapCache`
==========
`MapCache` defers to different underlying storage mechanisms based on
the key being stored:
* `string` -- Utilizes a `Hash` dedicated to string keys.
* `number` / `symbol` / `boolean` -- Utilizes a dedicated `Hash` for
these types (all are stored in the same `Hash`).
* Everything else falls back to using `ListCache`.
---
The overall strategy is to store items in the `ListCache` until it has
200 items in it, then we translate from `ListCache` to `MapCache` (which
actually uses 3 different structures internally depending on which
object type is being used as a key).
All credit to this mechanism goes to Lodash, they did incredible work
here and we are just utilizing their mechanisms. Once the performance of
this within Ember is validated, we will migrate away from this locally
vendored version of this file and simply use a stripped version of
`lodash` itself from the build.
0 commit comments