2 ms·
> Using "reduce" rather than a loop also has ~2x overhead ... Neither is really surprising I disagree. It all depends on where you're coming from, and what you
by int_19h 10y ago
> Using "reduce" rather than a loop also has ~2x overhead ... Neither is really surprising
I disagree. It all depends on where you're coming from, and what your expectations are. In C++, using reduce (std::accumulate) with a lambda is normally as fast as using a loop, because the compiler will inline the lambda into accumulate, and then accumulate into the calling function, producing the same exact loop.