1 abs > 1 compare

1 abs = 2 computer instruction
1 compare = 1 computer instruction

logic operations(or,and,xor,not etc), plus or subtraction, (+/-), compare (>,
multiplier/div (on a 32 bit size value in a 32 bit cpu) cost 1 cpu instruction too, but they are more expensive. div is the most expensive cpu instruction.

memory lookup (such as retrieve a number from array, etc int a= array[1])is more expensive it involves IO in memory

请您先登陆,再发跟帖!