What is faster: jne or jge?

Tigran Aivazian (tigran@aivazian.demon.co.uk)
Sun, 31 May 1998 17:38:57 +0100 (BST)


Hello guys,

Someone asked me a simple but classical question:

What is better:

This: if (some_syscall() < 0) {
....
}

Or this: if (some_syscall() == -1) {
....
}

For some system calls (e.g. lseek(2)) one does not have the luxury of
choice (because negative results aren't necessarily erroneous) but for
most others it is only a matter of taste and both are "right"; so I
answered "since in the first case cc(1) will generate jge
instruction and in the second jne it depends on what is faster: jge or
jne".

But what *is* faster? I don't know. And Intel's website doesn't
immediately face one with something useful, such as a table of timings of
their instructions or detailed specs of some future generation
processors but instead greets one with tons of useless b.s. :)

Any pointers?

Regards,
Tigran.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu