V
Vivek Mandava
Hello All,
Which one is an expensive operation?
'>' or '==" ?
I know this won't matter much. However, if I'm executing this
operation million times, I would prefer the better choice.
My gut feeling is that '>' should be efficient. However, when
translated to assembly code all it generates is "cmpl" instruction
(gcc -S <prog.c>). So, my question here is :: how is "cmpl"
instruction executed by the cpu?
Ex: (1) if (n == 0) vs if (n > 0)
(2) if (len == 12) vs if (len < 13)
Thanks in advance.
Regards,
Vivek
web: http://students.iiit.net/~vivek/
Which one is an expensive operation?
'>' or '==" ?
I know this won't matter much. However, if I'm executing this
operation million times, I would prefer the better choice.
My gut feeling is that '>' should be efficient. However, when
translated to assembly code all it generates is "cmpl" instruction
(gcc -S <prog.c>). So, my question here is :: how is "cmpl"
instruction executed by the cpu?
Ex: (1) if (n == 0) vs if (n > 0)
(2) if (len == 12) vs if (len < 13)
Thanks in advance.
Regards,
Vivek
web: http://students.iiit.net/~vivek/