Hacker News new | ask | show | jobs
by twsted 2063 days ago
But

   arr.foreach(elem => { ... });
is still always much slower than a for loop, having the callback call, isn't it?
1 comments

That very much depends on how good the JIT is, certainly many AOT compilers would understand this pattern and inline the callback, resulting in very similar optimised code.