assemblycpumachine-instructionmachine-code

How long does each machine language instruction take to execute?


Do operations like set, read, move and compare all take the same time to execute?

If not: Is there any way to find out how long.

Is there some name for what I mean, some specific type cpu's speed of executing the different assembly language instructions (move, read, etc.)


Solution

  • The key terms you're probably looking are:

    These should be easy to google for. But basically, instructions take a certain number of cycles to execute (latency). But you can often execute multiple of them simultaneously (throughput).

    Do operations like set, read, move and compare all take the same time to execute?

    In general no. Different instructions have different latencies and throughputs. For example, an addition is typically much faster than a division.


    If you're interested in the actual values of different assembly instructions on modern processors, you can take a look at Agner Fog's tables.


    That said, there's about a gazzillion other factors that affect the performance of a computer.
    Most of which are arguably more important than instruction latencies/throughputs: