htm-community / comportex

Hierarchical Temporal Memory in Clojure
154 stars 27 forks source link

caching in encoders #20

Open floybix opened 9 years ago

floybix commented 9 years ago

Some encoders run non-trivial computations: currently the coordinate encoder and unique (random) encoder. We should cache the results for performance.

For JVM there is the very nice core.cache with a choice of expiry strategies: https://github.com/clojure/core.cache/

There doesn't seem to be a good clojurescript port, but it would be easy to pull out LRUCache from https://github.com/clojure/core.cache/blob/master/src/main/clojure/clojure/core/cache.clj