Shop OBEX P1 Docs P2 Docs Learn Events
Time for operations to run. — Parallax Forums

Time for operations to run.

EPhantom125EPhantom125 Posts: 4
edited 2008-04-28 18:05 in BASIC Stamp
I'm working on a project that is all about time... and I need to know how long the bs2 stamps operations run... I am trying to make my project as fast as it can get... I found a site that has some of them, but I don't know how reliable it is, nor does it have some of the operations...
Does anyone know of somewhere that I can get·the time it takes for all operations to run, including math?

Current operations I know I need to know how long they run:
labels
if in1=1 then label
goto label
x=a+b+c ...

And do notes in a program take time?

Thank you for your time

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-28 18:05
    If, by notes, you mean comments. They don't take any time. They're stripped out of the program when it's compiled.

    Labels also don't take any time.

    The best reference for statement timing is at www.emesystems.com.

    The best way to find the timing for specific statements is to write a program that puts out a message using a DEBUG statement, then does a loop 30000 times, then puts out another message with a DEBUG statement. You run the program, use a stopwatch to time the interval between the two messages. You insert the statement you want in the loop so it executes within the loop and run the program again and time it. Subtract the two times and divide by 30000. The result is the time for the statement's execution. Typical statements take about 333us. Your total time for the 30000 times through the FOR loop would be around 10 seconds.

    Post Edited (Mike Green) : 4/28/2008 6:11:20 PM GMT
Sign In or Register to comment.