Thursday, December 27, 2018

performance - What will be faster, >= or >?




I was wondering if > is faster then >= ?
I tried to benchmark it but either it takes 0ms or it takes forever.
I understand that the difference will be really small but i have to operate on a lot pixels.
Can someone tell me what is faster?



Answer



Both comparisons will be compiled to machine instructions like BLT (branch on less than) or BLE (branch on less equal), which check some status bits like BLT: N-V + -NV (negative & not overflow or not negative and overflow) or BLE: Z + N-V + -NV (zero or negative & not overflow or not negative and overflow).
These instruction take normally exactly the same time, so they are equally fast.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...