5 ms·
This is a very interesting exercise CPUs are very capable today, unfortunately, to get 'every last drop of performance' is very difficult. I'd say that CPUs a
by raverbashing 14y ago
This is a very interesting exercise
CPUs are very capable today, unfortunately, to get 'every last drop of performance' is very difficult.
I'd say that CPUs are more complex than compilers can optimize the code for them.
Of course, manually optimizing for something like this is "easy" (if you have a somewhat deep knowledge of Intel's manuals)
Now for "everyday computing" this gets tougher, even though compilers do a good job (good, not great) and it's usually good enough.
So you end up going to the deeper details in time-sensitive things: games, video processing, etc
There are some tools (from Intel and AMD, even though I tested only the AMD one some time ago) that tells you 'everything' that you need to know about how good your code is. For example, IIRC, if you load a register then immediately store to it (or store then load, I don't remember), there's a stall, so you can do something else in between