Main Site Documentation

Maths on the fez


#1

This is aimed at the guy’s at GHI really

I am optimising certain math routines ie ,* 8, / 8 etc…
but when I optimise x / 8 and replace with x >> 3, I barely see any discernible speed change…

Are the math routines already optimised?

Ian


#2

It should be faster but since NETMF is interpreted, the overhead for an instruction might make this less significant.
Try it in a loop of 1000 times what results do you get?

start timing
for(int i = 0; i < 1000; i++)
result = x /8;
end timing


#3

It’s in a pixel drawing routine so there are quite a few iterations…

It must be the managed code overhead.

This gives me a push to try RLP. But as I’m watching this site, I’ve noticed that optimizing RLP is an art in itself…

Ian


#4

Yeah, if you want to speed things up, someday you’ll need to write some assembly, those free arm compilers don’t or are very bad in optimising the output. I figured that out while creating a rlp setline method. Even with everything in asm I did not reach the speed of Bitmap.DrawLine. the call to rlp takes too long for that.