Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the engine faster when nested for loops are used #564

Closed
emilos opened this issue Mar 5, 2020 · 2 comments
Closed

Make the engine faster when nested for loops are used #564

emilos opened this issue Mar 5, 2020 · 2 comments

Comments

@emilos
Copy link
Contributor

emilos commented Mar 5, 2020

todos: pure-engine x 6,225,365 ops/sec ±0.44% (87 runs sampled)
todos: underscore x 243,470 ops/sec ±0.29% (92 runs sampled)
todos: lodash x 285,776 ops/sec ±0.98% (91 runs sampled)
todos: handlebars x 793,441 ops/sec ±0.90% (90 runs sampled)
todos: mustache x 555,694 ops/sec ±0.48% (93 runs sampled)
Fastest is pure-engine
  ✔ benchmark: todos (30.7s)
friends: pure-engine x 1,683,728 ops/sec ±1.31% (88 runs sampled)
friends: underscore x 77,904 ops/sec ±0.74% (86 runs sampled)
friends: lodash x 98,544 ops/sec ±0.69% (89 runs sampled)
friends: handlebars x 803,258 ops/sec ±1.09% (90 runs sampled)
friends: mustache x 149,535 ops/sec ±1.22% (89 runs sampled)
Fastest is pure-engine
  ✔ benchmark: friends (30.5s)
if: pure-engine x 55,449,018 ops/sec ±1.55% (82 runs sampled)
if: underscore x 503,654 ops/sec ±0.95% (86 runs sampled)
if: lodash x 494,785 ops/sec ±1.22% (90 runs sampled)
if: handlebars x 841,275 ops/sec ±1.57% (83 runs sampled)
if: mustache x 737,372 ops/sec ±0.65% (92 runs sampled)
Fastest is pure-engine
  ✔ benchmark: if (30.4s)
projects: pure-engine x 1,873,031 ops/sec ±1.18% (84 runs sampled)
projects: underscore x 106,251 ops/sec ±0.31% (90 runs sampled)
projects: lodash x 141,294 ops/sec ±1.09% (91 runs sampled)
projects: handlebars x 721,065 ops/sec ±0.58% (87 runs sampled)
projects: mustache x 226,439 ops/sec ±0.98% (88 runs sampled)
Fastest is pure-engine
  ✔ benchmark: projects (30.8s)
search: pure-engine x 658,409 ops/sec ±1.37% (84 runs sampled)
search: underscore x 24,063 ops/sec ±0.96% (86 runs sampled)
search: lodash x 27,057 ops/sec ±1.00% (87 runs sampled)
search: handlebars x 767,058 ops/sec ±0.60% (85 runs sampled)
search: mustache x 103,704 ops/sec ±0.53% (92 runs sampled)
Fastest is handlebars
  ✔ benchmark: search (30.3s)

The engine is losing in the last benchmark, probably because we're not assigning variables in the best way (they're probably inlined right now, which is not ideal).

@emilos emilos changed the title Make the engine faster for nested for loops Make the engine faster when nested for loops are used Mar 5, 2020
@zaiste
Copy link
Contributor

zaiste commented Mar 5, 2020

@emilos I was just running this benchmark, trying to figure out the last test. What a coincidence! ;)

@emilos
Copy link
Contributor Author

emilos commented Mar 5, 2020

@zaiste 👍 the easiest way to debug this is to check what code is being generated by the compiler (basically console.log(template.toString())).

The output should be at least as good as if you were to type it by hand, if it's not then there's probably some performance bottleneck. Some other optimizations apply too of course, but in general less code is better.

@emilos emilos closed this as completed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants