kbanks
01-22-2008, 03:21 PM
The question often comes up "How fast do Snappy scripts run?"
While by no means an exhaustive survey, we did take some measurements today.
(The following timings were measured using an external logic analyzer)
Time to write to a GPIO pin
approx. 181 uS (181 microseconds)
In other words, Snappy can toggle a GPIO in approx 364 uS.
Time to read an ADC value
approx. 260 uS
This number does not include any time to actually do something with the reading, but that processing would depend upon your specific application.
How high can Snappy count in 1 second?
counter = N
while counter:
counter -= 1
N = 4500 comes out to be approx. 999.738 ms (milliseconds)
NOTE! You should not be implementing delays in your scripts using loops!
Use the HOOK_100MS event instead! We only did this as a crude benchmark.
While by no means an exhaustive survey, we did take some measurements today.
(The following timings were measured using an external logic analyzer)
Time to write to a GPIO pin
approx. 181 uS (181 microseconds)
In other words, Snappy can toggle a GPIO in approx 364 uS.
Time to read an ADC value
approx. 260 uS
This number does not include any time to actually do something with the reading, but that processing would depend upon your specific application.
How high can Snappy count in 1 second?
counter = N
while counter:
counter -= 1
N = 4500 comes out to be approx. 999.738 ms (milliseconds)
NOTE! You should not be implementing delays in your scripts using loops!
Use the HOOK_100MS event instead! We only did this as a crude benchmark.