1. Timing Code

I'm not sure if this will work well but try this.
Time how long it takes to do all repeats of the code.
Find out how long it took to do the loop and code you wish to ignore.
Then subtract the loop time from the total time.
There is no worrying about ticks etc. It will tell you the average time to do
something, I think.
This is OTTOMH (off the top of my head).

-----<Untested Code>-----
atom time_now, time_taken

time_now = time()
for t = 1 to 1000 do
    -- Code
end for
time_taken = time() - time_now

time_now = time()
for t = 1 to 1000 do
    -- Code you wish not to time.
end for
time_taken = time_taken - (time() - time_now)

printf(1,"Average Time : %g sec\n", time_taken / 1000 )
-----<End>-----

-----
Sincerely,
Mathew Hounsell
Mat.Hounsell at Mailexcite.Com




Free web-based email, Forever, From anywhere!
http://www.mailexcite.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu