loading...

re: Using arrow functions might be costing you performance VIEW POST

FULL DISCUSSION
 

Actually jsPerf shows that arrow functions with implicit return are the fastest.

Functions comparision

But the difference in performance is so small, that it shouldn't be taken into account when deciding what type of function to use.

 

Agreed. With a difference of 1.5M operations per second, and assuming a screen refresh time of 16.66 (that's repeating, of course) milliseconds, you would have to execute 250K of the faster option changed to the slower one to make a noticeable difference even to a professional Starcraft player.

 
 

In my test run the results are almost the same for all three tests (ops/sec varies +-1%).

That is the point ;)

This article is pretty fear mongering and statistically incorrect 🤓.

  • Don't worry about using arrow function expressions
  • Don't worry about using implicit return

In the same line:

  • Don't worry about relying on Automatic Semicolon Insertion
  • Don't worry about using "class"es or (other) prototype-inheritance

The bottleneck of the code is not going to be in the syntax one uses.

code of conduct - report abuse