Skip to content

Comment on Summing ASCII encoded integers on Haswell at almost the speed of memcpy

Comments

I think the trick with dereferencing unmapped memory is cool, but I only really care about techniques that work reliably and I can use in production.

To be clear, it’s not dereferencing unmapped memory, I just haven’t shown how it’s being mapped, because it’s a little complex. As I note in the post, you can imagine as if I mmap all the necessary addresses at the start of the program.

Given that the input is "integers uniformly sampled from [0, 2³¹−1]" couldn't you use a LUT for the 99.99% case of just 10/9/8 digit numbers instead and have a cold branch the handle the very rare smaller numbers.

Yes, maybe if one is clever and lucky this could cost only a popcnt and a branch? not sure.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.