Pergunta

I have a set of algorithms to choose from based on their execution speed. I know that it is very hard to get an accurate measurement due to the process scheduling, the time that is actually consumed to get the measurement ... etc.
I was wondering if a microcontroller ( like arduino uno) can provide better accuracy compared to an OS driven computer system ( at least no scheduling).

Foi útil?

Solução

Execution speed isn't just a function of algorithm, it's also usually a function of how big the dataset is. For that reason algorithm choice can often be done simply from analysis without even having to implement it.

But if you do want to measure, then measure on the real target. Yes, there will be a certain amount of noise from the scheduler - but that applies to every measurement, and will not in and of itself bias in the direction of one choice. You just need to make sure you take enough measurements.

Outras dicas

What do you want - more precise / reproducible results, or faster algorithms?

It's pointless to measure speed on a microcontroller if you don't run the algorithm on a microcontroller. You might get highly precise measurements that algorithm A is exactly 5.21% faster running on the microcontroller while on the hardware that the algorithm is designed for, algorithm B is between 5% and 10% faster.

Measure what you want to optimise, not something that you don't really care about.

Licenciado em: CC-BY-SA com atribuição
scroll top