News for hackers. Stuff that matters.
Re:The One Billion Row Challenge in Go: from 1m45s to 4s in ... by saagarjha on Monday March 04, 2024 @06:00AM (#39589023)
I've only really seen decent results on the simplest of examples, like a bounded loop with a basic operation in it (like, adding all the numbers in an array). As soon as you go beyond that I see much worse code: reloading things inside the loop body that really should have been hoisted out, spilling for no good reason, weird contortions to shove certain things into scalar registers in the middle only to take them out again. And, of course, if your control flow is not trivial the compiler will often not recognize the loop as vectorizable at all.
Re:The One Billion Row Challenge in Go: from 1m45s to 4s in ... by dzaima on Monday March 04, 2024 @07:02AM (#39589425)
Unknown-bound loops are not vectorizable in general (at least not sanely; you'd need masked stores, aligned writes, and a bunch of handling for different cases of bound computation). I haven't seen many cases of missed hoisting (outside of register pressure, where it's not really "missed") or pointless moving to scalar (at least with clang; I've looked at gcc much less), nor control flow be much of an issue either, both compilers can handle conditional loads & stores where available.