Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Where can I find the x86 instructions execution time? How to find out which instruction is faster or smaller?

share|improve this question
add comment

2 Answers

http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html - you want the software developer manual for the CPU you are interested in.

Keep in mind that there is no "time" for each instruction, these days. You have out of order execution, memory and register stalls, and instruction level parallelism to take into account.

The raw numbers are in those manuals, though.

share|improve this answer
1  
Also its varies wildly between chips, an instruction which could takes ages on an atom, could, be done ten times faster on a XEON. –  James Anderson Feb 9 '12 at 1:20
    
Don't forget about page misses. The exact same instruction on the same processor (same physical hardware) could takes order of magnitude differences in time. –  mattnz Feb 9 '12 at 1:28
    
+1: It's completely unknowable. –  DeadMG Feb 9 '12 at 4:46
    
Not completely, although it is less deterministic than might be nice. You can certainly, for example, get value out of selecting appropriate assembly level representations of operations, or understanding the relative cost of operations at a statistical level - or even a "based on queried cache size" level. –  Daniel Pittman Feb 9 '12 at 4:53
add comment

Daniel already summed up the answer, +1 to that. Bottom line is that on modern CPUs with over 2 billion transistors, they do such crazy things that you can't look at assembly instructions and expect to guess timing. The only thing you can really do is write code and measure its performance.

On that note, if you are curious about learning more, take a look at http://www.flounder.com/exceptions.htm. The guy who wrote that article is a PhD and actually has a lot of cool things to say about many things. I've spent some time going through all his articles. The one I'm linking talks about measuring performance of exception handling and he goes right down to assembly instruction level.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.