FWIW-
there are variations in the results of timing loops
WHILE..LOOP are faster than FOR..NEXT; as Bruce states
'
while working on a Multi-Task scenario - I wanted to
eliminate the WAIT() and WAITMICRO() statements; so
I decided to use a timing loop that just increments
a value [for 6 millisecs]. I preceded the loop and the
exit with a "variable = TIMER", subtracted them, and printed it.
here are some results using 5 different 'conditionals'
1) dim'ed variable, 2) CONST, 3) debugin variable,
4) specifically defined, and 5) an Array(3) variable
.
Timing Loop Variations
Timing Loop Variations
- Attachments
-
- loop-variations.xls
- (6 KiB) Downloaded 639 times
-
- loop-variations.ods
- (10.72 KiB) Downloaded 671 times
Re: Timing Loop Variations
here are screen capture of the program listing and its result inBT
This is for the WHILE..LOOP conditionals
This is for the WHILE..LOOP conditionals
- Attachments
-
- delay-debugin.jpg (143.75 KiB) Viewed 15942 times
-
- delay-CONST.jpg (122.83 KiB) Viewed 15942 times
-
- delay-array.jpg (124.83 KiB) Viewed 15942 times
Re: Timing Loop Variations
two more for WHILE..LOOP
- Attachments
-
- delay-variable.jpg (133.48 KiB) Viewed 15942 times
-
- delay-specific.jpg (140.96 KiB) Viewed 15942 times
Re: Timing Loop Variations
these are for the FOR..NEXT loop
- Attachments
-
- delay-for-debugin.jpg (114.17 KiB) Viewed 15942 times
-
- delay-for-CONST.jpg (110.61 KiB) Viewed 15942 times
-
- delay-for-array.jpg (121.96 KiB) Viewed 15942 times
Re: Timing Loop Variations
the rest of the FOR..NEXT loops
- Attachments
-
- delay-for-variable.jpg (108.53 KiB) Viewed 15942 times
Re: Timing Loop Variations - DO..UNTIL
I thought of another loop method/conditional
using the DO...UNTIL command - faster results
'
using the DO...UNTIL command - faster results
'
Re: Timing Loop Variations
Code: Select all
while x
x=x-1
loop
There will also be variations depending on the size of the constant. ARM assembly allows 8 bit values to be loaded in one instruction, some constants can be done by combining shifted constants. For longer one a PC relative load is used, and depending on the context of your code, this can add a branch around the constant.
Variables are done using register relative load and store, so the first 32 variables will be the fastest. After that multiple instructions will be required.
Tod's EBT can be useful to display the compiled code.
Re: Timing Loop Variations
Thanks for the info - I was suspicious of register/memory usage/branches that
would be needed for the different 'loops' that you would create - haven't delved
too much into the Assembler(on the ARM),,,yet.
'
I needed an 'exit' condition as I was trying to avoid WAITMICRO..WAIT...I was
suspicious that it effect the 'MultiTask.bas' program that I was using.
I added a 5th SUB/ENDSUB and was getting strange results... the time
allotted to each task AND the early "exit" make a very BIG difference in
the program timing.
'
Might be posting some 'MutiTask' in a bit.....
Gary Olzeke51
'
would be needed for the different 'loops' that you would create - haven't delved
too much into the Assembler(on the ARM),,,yet.
'
I needed an 'exit' condition as I was trying to avoid WAITMICRO..WAIT...I was
suspicious that it effect the 'MultiTask.bas' program that I was using.
I added a 5th SUB/ENDSUB and was getting strange results... the time
allotted to each task AND the early "exit" make a very BIG difference in
the program timing.
'
Might be posting some 'MutiTask' in a bit.....
Gary Olzeke51
'