Perf for low level Haskell profiling
fpcomplete.com
fpcomplete.com
If you're not using precise events, then the instruction addresses reported by perf will have some skid. This is a small cpu delay from when a performance counter overflows to when the interrupt actually freezes state.
You can choose precise sampling for some events, depending on the CPU. Try "-e cycles:pp" for instance.
0,09 │ mov (%rax,%r8,4),%eax
29,32 │ mov %r14,%r8
I think this first mov from memory is likely to be your true cycle eater, much more so than the second mov reg-reg or any single xor/and operations. But don't optimize based on my hunch - measure it precisely first! If memory access proves to be your slowdown, then you can try optimizing your access patterns.It turned out to be a useful exercise, since adler32 in digest gave incorrect checksums, due to initialization to 0 rather than 1:
https://github.com/jkff/digest/pull/1
Anyway, thanks to Francesco Mazzoli for the really nice article!
Word-aligning, though - that's a different story.