News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

instruction performance calculator?

Started by thomas_remkus, March 19, 2008, 04:53:01 PM

Previous topic - Next topic

thomas_remkus

I have an older book that I use as a reference at times. It's called "Optimizing C with Assembly Code" and it has lots of tips for laying down your instructions in a manner that's friendly to the computer. In the book there are references to where instruction X used to be good but now it's Y that's the favorite. Is there a tool that exists that people use that tests theses kinds of things?

Maybe the tool reports that on this particular CPU the following XXXX instructions or methods are n% faster than YYYY instructions or techniques. Just thought this might be helpful as new CPUs come out or that I need to write code for a particular CPU this sort of information would be very helpful. On thing I recently ran across was MOV/LEA for ADD/SUB and how EFLAGS were not updated.

u

Both Intel and AMD have published detailed info on cycles/latencies/pipelining of each and every instruction.
It's usually a breeze to optimize nowadays :).
And if you have doubts at some time, just make a speed-test app and upload it here, for us to check and report on a wide variety of setups.
I think it's easiest to judge your code by making 4 benchmarks (with those code-timing macros), which are just variations of the data to be processed:
1) millions of loops on on some small chunk, possibly fitting in L1
2) large linear/convenient data
3) large very random/inconvenient data
4) medium-sized realistic data.
Please use a smaller graphic in your signature.