Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • I think it still matters but I believe the JITs have made function calls considerably zippier. Commented Apr 2, 2012 at 19:43
  • Me too =) Especially after that, I sped up CPU-heavy JS code ~5 times with just inlining functions. Commented Apr 2, 2012 at 20:07
  • No matter what I try, forEach is always faster in Chrome. Commented Dec 2, 2015 at 1:06
  • Didn't know this 4 year ago but it's because modern JITs actually cache inline functions in the right circumstances. In old interpreters the buildup/teardown process of a function call made them undesirable in loops. Now they can actually be performance optimizing. It's probably best to avoid referencing anything that isn't defined in the function or passed to it as an argument. Commented Apr 5, 2016 at 17:53