Speed MyDriver Day !!!
-
My Code is runnnig the same function 100000000000000000 times a day I want to speed my function runnig time. so...the qst is: which type of code is more effective:
return Convert.ToBoolean((var >> n) & 0x1));
orif (((var >> n) & 0x1) == 0) return true; else return false;
:-\ -
My Code is runnnig the same function 100000000000000000 times a day I want to speed my function runnig time. so...the qst is: which type of code is more effective:
return Convert.ToBoolean((var >> n) & 0x1));
orif (((var >> n) & 0x1) == 0) return true; else return false;
:-\Almost certainly the second I'd have thought, although they appear to return the opposite of each other your two methods. With stuff like this, stick it in a loop and time it for millions of times, you'll soon get any idea of which method is best. Having said that, in my experience what works well on an AMD based machine may not be the best way of Intel and vice-versa. To do with the JITing I'd imagine.
Regards, Rob Philpott.
-
Almost certainly the second I'd have thought, although they appear to return the opposite of each other your two methods. With stuff like this, stick it in a loop and time it for millions of times, you'll soon get any idea of which method is best. Having said that, in my experience what works well on an AMD based machine may not be the best way of Intel and vice-versa. To do with the JITing I'd imagine.
Regards, Rob Philpott.
This is not my true code...You right I have a mistake in my example tnx for your help
-
My Code is runnnig the same function 100000000000000000 times a day I want to speed my function runnig time. so...the qst is: which type of code is more effective:
return Convert.ToBoolean((var >> n) & 0x1));
orif (((var >> n) & 0x1) == 0) return true; else return false;
:-\ -
return ((var >> n) & 0x1) == 0);
Probably faster than the first solution.
Standards are great! Everybody should have one!
work faster...tnx. :-D