Search code examples
knockout.jsknockout-components

Are components really faster compared to templates?


I decided to compare speed of components with ko 3.2 versus other template engines by adding components test in the following jsperf:

http://jsperf.com/knockout-template-engines/19

The results are really puzzling me, since I see components to be 98% faster than regular templates. I feel I am doing something wrong, but unable to figure out.

Can some expert shed some light on this? Is this performance real or I am seeing incorrect benchmark results?


Solution

  • It's hard to compare async performance with the other templates, but I hacked up the ko component test case (very ugly hack, sorry) to check that it's done on a setInterval: http://jsperf.com/knockout-template-engines/21 just to get an idea. It seems to perform comparably to the others.

    A real-world example shows that this is not likely to be your performance bottleneck: https://metrics.wmflabs.org/static/public/dash/