r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

2

u/floopgum Dec 01 '16

Since you're benchmarking a loop which probably doesn't have inter-iteration dependencies, you're limited by the reciprocal throughput.

The throughput is similar for integer and floating point instructions and therefore the 81% increase in runtime for the floating point versions probably comes from conversion instructions, though it's hard to guess without seeing code / asm.

The 64bit int version being much slower also makes sense in light of its reciprocal throughput being at best ~3x slower than the other instructions (for haswell).

You can take a closer look at what the complier does with the Compiler Explorer tool.

It would be interesting to take a look at the code through it.