openlayers/ol3 — pull request #176 by twpayne (2013-02-04 17:26:13+00:00)
Title: LRU Cache

This pull request replaces the use of `goog.structs.LinkedMap` with `ol.structs.LRUCache`. `ol.structs.LRUCache` uses an `Object` for its dictionary structure, making it approximately twice as fast as `goog.structs.LinkedMap` but limiting the allowed keys. This also saves approximately 400 bytes from the compiled and compressed output.

Uncompiled, `ol.structs.LRUCache` is fractionally slower than [rsms/js-lru](https://github.com/rsms/js-lru). Compiled, it is fractionally faster [1].

Note that `ol.structs.LRUCache` leaves the expiration of items from the cache to the user. This is because we try to expire caches between `requestAnimationFrame` callbacks to maintain reactivity and frame rate, and because some caches have non-trivial expiration logic.

Note also that `ol.structs.LRUCache` does currently allow a key's value to be changed using `set`. This functionality is not currently needed, but can be added if required.

[1] http://jsperf.com/lru-cache-get/4