Buzby
Senior Member
Hi All,
Some of you have an avid interest in the execution speed of Picaxe instructions, so you may know the answer already.
I need to shave every last microsecond off the execution time of a routine which has the following requirement.
The 'lookup' instruction is slow, but is it slower than three maths instructions ?
Or can hippy come up with a bit-twiddle solution that's faster than both my ideas ?
Cheers,
Buzby
Some of you have an avid interest in the execution speed of Picaxe instructions, so you may know the answer already.
I need to shave every last microsecond off the execution time of a routine which has the following requirement.
The 'lookup' instruction is slow, but is it slower than three maths instructions ?
Or can hippy come up with a bit-twiddle solution that's faster than both my ideas ?
Code:
Var1 has a value from 1 to 9. Using Var1, set Var2 to the result 4 to 20.
Which is quickest ?
Var2 = Var1 - 1 * 2 + 4
or
lookup Var1, (0,4,6,8,10,12,14,16,18,20), Var2
Buzby