News for hackers. Stuff that matters.
Re:Clever code is probably the worst code you could write by a_t48 on Tuesday May 21, 2024 @10:53PM (#40436885)
The linked page has benchmarks - I'd have to go dig into godbolt to see why it's faster. The standard library can actually auto-parallelize, but you have to opt in (see the ExecutionPolicy argument).

Edit: I don't know how to dig into the actual implementation of std::reduce on godbolt - it's not inlined. I think the sibling comment has it right though - one can do adds of four at a time with whatever SIMD extensions are available.

There are no comments on this comment yet.