I've read that short jumps are to be used when the relative jump is less than 124 in address, and long jumps should be used otherwise.
What is the difference in terms of operations performed in the CPU / performance between the two types of jumps on x86?
There are actually three types of JMP
instructions; short, near and far (long).
A short JMP
is the relative JMP
that you refer to. It is encoded as a two bytes; the actual JMP
and the number of bytes +/- relative to the current IP.
A near jump allows you to jump within the current "segment" (using real mode terms) or within the currently selected memory area in the CS selector.
A long or Far JMP
additionally includes a selector (or segment in real mode)
You can look up the timings for yourself. The biggest difference related to time is caused by the different numbers of bytes that must be read to accomplish the JMP
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With