Re:Which one will execute faster, if(flag==0) or if(0==flag)?
by cdavid on Saturday January 08, 2011 @01:54AM
(#2082500)
OTOH, measuring this kind of things is quite hard - it is only a couple of cycles assuming the optimistic case, so smaller than most measurement methods overhead.
People often wrongly assume that you can just execute many times the thing in a loop, and compute the average, which is the wrong statistic (you want the min, not the average when measing the speed of something which has a fixed cost).
By itself, the question is pretty stupid - maybe that's what the interviewer was getting at ?
People often wrongly assume that you can just execute many times the thing in a loop, and compute the average, which is the wrong statistic (you want the min, not the average when measing the speed of something which has a fixed cost).
By itself, the question is pretty stupid - maybe that's what the interviewer was getting at ?