Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to test speed?

Author
Message
Olympic
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location:
Posted: 25th Aug 2004 12:09
I mean I made a function and I want to test its speed.

like this:

a=timer()
for time=1 to 100
function()
next time
a=timer()-a
print a

The problem is this time keep changing, how can I get a fixed time?
Thanks!
JokerZ
AGK Silver Backer
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Perth, Western Australia
Posted: 25th Aug 2004 13:25 Edited at: 25th Aug 2004 13:25
try this

b=timer()
for time=1 to 100
function()
next time
a=timer()-b
print a

Everything happens for a reason
Olympic
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location:
Posted: 25th Aug 2004 19:58
same!
Zokomoko
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 25th Aug 2004 20:08
I don't think the time result can be the same every run.
the timer() is not very accurate, and every run's computer speed is different by the other (very little different, but still different).

your time result should represent an approx estimate.
Olympic
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location:
Posted: 25th Aug 2004 20:33
sorry, I mean his is same as mine, the value keep changing and I cannot catch a value at all!
Zokomoko
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 25th Aug 2004 21:51 Edited at: 25th Aug 2004 21:53
ok, i understand.

DO
cls
a=timer()
for time=1 to 1000
function()
next time
a#=(timer()-a)/1000 `to give you seconds
singlefunction#=a#/1000 `to give you the value of 1 function, rather than a thousand.
text 1,1,"Speed of function : "+str$(singlefunction#)+" seconds"
wait 500 `this will suspend the program for half a second, giving you a change to see the number
LOOP

this will give you the approx speed of the function

Login to post a reply

Server time is: 2024-11-27 07:30:31
Your offset time is: 2024-11-27 07:30:31