Instruction path length

In computer performance, the instruction path length is the number of machine code instructions required to execute a section of a computer program.

The total path length for the entire program could be deemed a measure of the algorithm's performance on a particular computer hardware.

The path length of a simple conditional instruction would normally be considered as equal to 2,[citation needed] one instruction to perform the comparison and another to take a branch if the particular condition is satisfied.

Performing a simple table lookup on an unsorted list of 1,000 entries might require perhaps 2,000 machine instructions (on average, assuming uniform distribution of input values), while performing the same lookup on a sorted list using a binary search algorithm might require only about 40 machine instructions, a very considerable saving.

Expressed in terms of instruction path length, this metric would be reduced in this instance by a massive factor of 50 – a reason why actual instruction timings might be a secondary consideration compared to a good choice of algorithm requiring a shorter path length.