Repository navigation
1.0.2
Info
This release upgrades to json-logic-engine's pre-release of 5.0.0-1, which comes with some further performance enhancements and switches the default truthiness model over to the same one Handlebars has.
This means that empty arrays are now falsey by default, rather than opt-in.
You may still override engine.truthy if you wish, but this further improves compatibility & optimizes performance 😄
Benchmarks
1 Million Iterations Benchmark
Handlebars Simple: 2017.37ms | 1.00x
Elastic Simple: 1394.87ms | 1.45x
JLE Interpreted Simple: 64.74ms | 31.16x
JLE Async Simple: 119.72ms | 16.85x
JLE Simple: 3.52ms | 572.33x
---
Handlebars SimpleEach: 2333.80ms | 1.00x
Elastic SimpleEach: 3443.25ms | 0.68x
JLE Interpreted SimpleEach: 407.06ms | 5.73x
JLE Async SimpleEach: 196.76ms | 11.86x
JLE SimpleEach: 74.13ms | 31.48x
---
Handlebars SimpleIf: 2192.54ms | 1.00x
Elastic SimpleIf: 1513.52ms | 1.45x
JLE Interpreted SimpleIf: 146.76ms | 14.94x
JLE Async SimpleIf: 113.33ms | 19.35x
JLE SimpleIf: 13.73ms | 159.73x
---
Handlebars SimpleIf (False): 2188.63ms | 1.00x
Elastic SimpleIf (False): 1507.48ms | 1.45x
JLE Interpreted SimpleIf (False): 158.28ms | 13.83x
JLE Async SimpleIf (False): 113.94ms | 19.21x
JLE SimpleIf (False): 16.36ms | 133.76x
---
Handlebars NestedIf: 2196.06ms | 1.00x
Elastic NestedIf: 1511.40ms | 1.45x
JLE Interpreted NestedIf: 151.04ms | 14.54x
JLE Async NestedIf: 111.97ms | 19.61x
JLE NestedIf: 15.68ms | 140.05x
---
Handlebars NestedIf (False): 2559.35ms | 1.00x
Elastic NestedIf (False): 2411.12ms | 1.06x
JLE Interpreted NestedIf (False): 225.01ms | 11.37x
JLE Async NestedIf (False): 110.78ms | 23.10x
JLE NestedIf (False): 18.36ms | 139.41x
---
Handlebars NestedIf (18): 2208.19ms | 1.00x
Elastic NestedIf (18): 1509.06ms | 1.46x
JLE Interpreted NestedIf (18): 155.59ms | 14.19x
JLE Async NestedIf (18): 110.93ms | 19.91x
JLE NestedIf (18): 15.27ms | 144.57x
---
Handlebars EachStatic: 2652.78ms | 1.00x
Elastic EachStatic: 5322.06ms | 0.50x
JLE Interpreted EachStatic: 30.64ms | 86.59x
JLE Async EachStatic: 105.75ms | 25.08x
JLE EachStatic: 12.87ms | 206.07x
---
Handlebars AddExampleWithTraversal: 4018.28ms | 1.00x
Elastic AddExampleWithTraversal: 6341.39ms | 0.63x
JLE Interpreted AddExampleWithTraversal: 925.03ms | 4.34x
JLE Async AddExampleWithTraversal: 305.05ms | 13.17x
JLE AddExampleWithTraversal: 185.69ms | 21.64x
---
Handlebars Example 1: 3417.50ms | 1.00x
Elastic Example 1: 12986.96ms | 0.26x
JLE Interpreted Example 1: 1685.85ms | 2.03x
JLE Async Example 1: 327.32ms | 10.44x
JLE Example 1: 225.79ms | 15.14x
---
Handlebars YAML: 7117.54ms | 1.00x
Elastic YAML: 20597.85ms | 0.35x
JLE Interpreted YAML: 2692.07ms | 2.64x
JLE Async YAML: 404.25ms | 17.61x
JLE YAML: 298.43ms | 23.85x
---
Handlebars Partials: 5093.86ms | 1.00x
Elastic Partials: 23257.95ms | 0.22x
JLE Interpreted Partials: 710.38ms | 7.17x
JLE Async Partials: 158.05ms | 32.23x
JLE Partials: 55.32ms | 92.08x
1 Iteration (Cold) Benchmark
If templates were never re-used, and just used once, this measures the performance of such a requirement. Note that using the interpreted mode might be the most lightweight option in these scenarios.
Handlebars Simple: 3.16ms | 1.00x
Elastic Simple: 1.38ms | 2.28x
JLE Interpreted Simple: 0.11ms | 28.89x
JLE Async Simple: 0.18ms | 17.27x
JLE Simple: 0.18ms | 17.47x
---
Handlebars SimpleEach: 1.19ms | 1.00x
Elastic SimpleEach: 0.27ms | 4.45x
JLE Interpreted SimpleEach: 0.16ms | 7.51x
JLE Async SimpleEach: 0.16ms | 7.48x
JLE SimpleEach: 0.38ms | 3.16x
---
Handlebars SimpleIf: 0.69ms | 1.00x
Elastic SimpleIf: 0.13ms | 5.36x
JLE Interpreted SimpleIf: 0.17ms | 4.11x
JLE Async SimpleIf: 0.25ms | 2.80x
JLE SimpleIf: 0.25ms | 2.78x
---
Handlebars SimpleIf (False): 0.41ms | 1.00x
Elastic SimpleIf (False): 0.14ms | 2.84x
JLE Interpreted SimpleIf (False): 0.04ms | 9.49x
JLE Async SimpleIf (False): 0.06ms | 6.38x
JLE SimpleIf (False): 0.08ms | 5.28x
---
Handlebars NestedIf: 1.39ms | 1.00x
Elastic NestedIf: 0.19ms | 7.21x
JLE Interpreted NestedIf: 0.07ms | 20.92x
JLE Async NestedIf: 0.18ms | 7.93x
JLE NestedIf: 0.22ms | 6.34x
---
Handlebars NestedIf (False): 0.67ms | 1.00x
Elastic NestedIf (False): 0.24ms | 2.75x
JLE Interpreted NestedIf (False): 0.08ms | 8.79x
JLE Async NestedIf (False): 0.08ms | 8.92x
JLE NestedIf (False): 0.09ms | 7.42x
---
Handlebars NestedIf (18): 0.41ms | 1.00x
Elastic NestedIf (18): 0.17ms | 2.36x
JLE Interpreted NestedIf (18): 0.05ms | 8.11x
JLE Async NestedIf (18): 0.45ms | 0.91x
JLE NestedIf (18): 0.08ms | 5.03x
---
Handlebars EachStatic: 0.54ms | 1.00x
Elastic EachStatic: 0.28ms | 1.98x
JLE Interpreted EachStatic: 0.12ms | 4.64x
JLE Async EachStatic: 0.58ms | 0.94x
JLE EachStatic: 0.18ms | 3.05x
---
Handlebars AddExampleWithTraversal: 0.72ms | 1.00x
Elastic AddExampleWithTraversal: 0.36ms | 1.99x
JLE Interpreted AddExampleWithTraversal: 0.16ms | 4.40x
JLE Async AddExampleWithTraversal: 0.29ms | 2.52x
JLE AddExampleWithTraversal: 0.32ms | 2.27x
---
Handlebars Example 1: 0.92ms | 1.00x
Elastic Example 1: 0.28ms | 3.25x
JLE Interpreted Example 1: 0.30ms | 3.01x
JLE Async Example 1: 0.39ms | 2.38x
JLE Example 1: 0.42ms | 2.20x
---
Handlebars YAML: 3.76ms | 1.00x
Elastic YAML: 1.23ms | 3.06x
JLE Interpreted YAML: 0.67ms | 5.61x
JLE Async YAML: 1.12ms | 3.36x
JLE YAML: 1.50ms | 2.51x
---
Handlebars Partials: 1.95ms | 1.00x
Elastic Partials: 0.45ms | 4.31x
JLE Interpreted Partials: 0.22ms | 8.96x
JLE Async Partials: 0.19ms | 10.07x
JLE Partials: 0.43ms | 4.52x
You can compare against handlebars-lang/handlebars.js#1934 (comment) to see how performance has generally improved over time 😄