Live data from Hacker News

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

blog.mattstuchlik.com

1–10 of 41 posts

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

#3
post #2

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.

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

#4
Knew it'd be SIMD. Such an underrated feature of modern CPUs. Hopefully with cross-platform SIMD in Rust and Golang, it'll be more commonly used.

Thinking parallel gets you enormous speed benefits for any number of arbitrary algorithms: https://mcyoung.xyz/2023/11/27/simd-base64/

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

#8
post #3
post #2

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.

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

#9
First time I hear about HighLoad. Seems really interesting to me on the first glance. I personally find SIMD and ISA/μarch-specific optimizations more rewarding than pure algorithmic challenges (codeforces and such).

Though Haswell seems like a pretty obsolete platform to optimize for at this point. Even Skylake will be a decade old next year.

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

#10
post #9

First time I hear about HighLoad. Seems really interesting to me on the first glance. I personally find SIMD and ISA/μarch-specific optimizations more rewarding than pure algorithmic challenges (codeforces and such). Though Haswell seems like a pretty obsolete platform to optimize for at this point. Even Skylake will be a decade old next year.

[deleted]
Post reply on HN