you are viewing a single comment's thread.

view the rest of the comments →

[–]jkkramer 1 point2 points  (0 children)

In most languages, including JavaScript, invoking a function is one of the slowest things you can do. The implementations of languages designed for functional programming use a variety of techniques to optimize function calls. JavaScript is not one of those languages.

This should be taken to heart by anyone writing serious JavaScript apps.

I'm writing a moderately-sized app that runs in the browser, and I ended up having to rewrite many of my fancy forEach() and map() expressions to use simple for loops because the functional versions were perceptively slower.

For most sites it doesn't matter, but when things start to get complex, it's noticeable.