Jason Knight
Feb 24, 2023

--

Exactly that. A LOT of people seem to think that map/filter/whatever is magically NOT a loop, when that's all it is.

Which is fine and dandy if you find the callback mechanism useful and have a legitimate usage case for it such as object method lookups... but the way some people ONLY use them with arrow function truly begs the question?

What's the freaking difference?

And in most cases the ONLY difference is that those array methods are introducing function call overhead that just sucks more CPU and memory. Worse, said overhead is outside JS' execution scope and/or deferred, meaning you can't even bench for it from JS.

Which is why it would be nice if people benchmarking would open "top" or task manager once in a while.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

No responses yet