fig-tree-evaluator
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -62,3 +62,2 @@ "use strict"; | ||
this.queue.unshift(key); | ||
console.log('Using cached result:', this.store[key]); | ||
return [2, this.store[key]]; | ||
@@ -65,0 +64,0 @@ } |
{ | ||
"name": "fig-tree-evaluator", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "Module to evaluate JSON-structured expression trees", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -1317,3 +1317,3 @@ # fig-tree-evaluator | ||
If you have a node that is used more than once in a complex expression, it's possible to just evaluate the repeated node once, and refer to it throughout using an "alias" reference. This allows for a simpler expression (reduces duplication) as well as a performance improvement, since the aliased node is only evaluated once, providing a simple [memoization](https://en.wikipedia.org/wiki/Memoization) mechanism. | ||
If you have a node that is used more than once in a complex expression, it's possible to just evaluate the repeated node once, and refer to it throughout using an "alias" reference. This allows for a simpler expression (reduces code duplication) as well as a performance improvement, since the aliased node is only evaluated once, providing a simple [memoization](https://en.wikipedia.org/wiki/Memoization) mechanism. (See also [Caching/Memoization](#caching-memoization)) | ||
@@ -1389,3 +1389,3 @@ For example, if you have the expression: | ||
FigTree Evaluator has basic memoization functionality for certain nodes to speed up re-evaluation of previously evaluated nodes. There is a single cache store per FigTree instance which persists for the lifetime of the instance. By default, it remembers the last 50 results, but this can be modified using the `maxCacheSize` option. | ||
FigTree Evaluator has basic [memoization](https://en.wikipedia.org/wiki/Memoization) functionality for certain nodes to speed up re-evaluation when the input parameters haven't changed. There is a single cache store per FigTree instance which persists for the lifetime of the instance. By default, it remembers the last 50 results, but this can be modified using the `maxCacheSize` option. | ||
@@ -1400,2 +1400,6 @@ Currently, caching is only implemented for the following operators, since they perform requests to external resources, which are inherently slow: | ||
This is different to the memoization provided by [Alias Nodes](#alias-nodes): | ||
- Alias nodes are still evaluated once for every evaluation -- they're more for re-use *within* a complex expression. | ||
- Cached nodes will persist *between* different evaluations as long as the input values are the same as a previously evaluated node. | ||
## More examples | ||
@@ -1433,3 +1437,3 @@ | ||
- **v2.3.1**: Bug fix: alias nodes not working with `evaluateFullObject` (#72) | ||
- **v2.3.2**: Bug fix: alias nodes not working with `evaluateFullObject` (#72) | ||
- **v2.3.0**: Implement [caching/memoization](#caching-memoization) (#68) | ||
@@ -1436,0 +1440,0 @@ - **v2.2.3**: Change option `objects` name to `data` (but keep backward compatibility) (#66) |
230359
1460
3460