📜 ⬆️ ⬇️

JavaScript Optimization: How Resource-Consuming Call Chains?

Note: below is the translation of the article “JavaScript optimization, are chained calls expensive?” . In it, the author tests how much slower the chains of function calls are made compared to their cached counterparts. At the end are the results of my performance tests

Sree Kotay left a little JavaScript article on his blog . (If you are interested in technical details, I recommend reading the presentation of Simon Willison “A (Re) -Introduction to JavaScript” .) In his blog, Sree writes the following:

To understand the differences for the simplest case that follow from the understanding of the (obvious) basics of JS optimization, it is worthwhile to realize that:
  for (i = 0; i <100; i ++) abcd (v); 

')
... SIGNIFICANTLY slower, at least in JavaScript, than:

  var f = abcd;
 for (i = 0; i <100; i ++) f (v);
... because, after all, JS is a dynamic language. I will provide some more specific javascript tips and performance tests that will clarify this situation.


read further on webo.in →

Source: https://habr.com/ru/post/31497/


All Articles