Page 1 of 1

8/16/32-bit operations performance

Posted: 20 Feb 2011, 23:42
by ricardocrl
Hi,

I want to do some signal processing. I'm trying to process a color sensor signal in real-time. The fastest I process my signal, the higher will be the sample rate.

I'm using NXC. I see that, using a signal of 100~200 samples and doing some memory accesses makes it very slow very easily. It's a pity not to take advantage from the maximum sample rate of the sensor readings.

If someone has tips about getting good performances, I will appreciate. Of course, getting into NBC would be a way, but I don't want to put so many efforts for now, to jump to NBC.

One simple thing I could do, is to change the variable types, to the fastest way the CPU can process them. Is there a big difference, or such a difference, between using char/unsigned char/short int/int/long ? I only need integer computations and 8bits is enough for the values I am processing.

Cheers,
Ricardo

Re: 8/16/32-bit operations performance

Posted: 21 Feb 2011, 02:28
by afanofosc_99
The size of variables will make very little difference in NBC or NXC since the code is running in a VM. All of the types are "native" to the VM. However, in the firmware source code variables are passed around as longs so it may be slightly faster to stick with longs. Using floats will definitely slow things down.

John Hansen