Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed of SEEK, SEEK(), LOCATE, and SQL SELECT
Message
From
29/06/1999 11:24:50
 
 
To
29/06/1999 09:45:14
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00235086
Message ID:
00235287
Views:
18
>Hi Peter.
>
>I'd like to see the code you've been running. Its important to compare apples to apples.


Appended below:

***********************************************************************
* PROCEDURE TMSEEK.PRG
***********************************************************************
* Created.....: 1999.06.28
* History.....:
**********************************************************************

lparameter tnLoops

local lnLoops
local lnSeconds
local lnSeconds2
local lnKey

local array laName[1]

close data all
use SEEKTEST
=rand(-1)

if type("tnLoops")="N"
lnLoops = tnLoops
else
lnLoops = 100
endif

?
? str(lnLoops) + " random lookups -- avg time in MS"

** This is just to load up indexex etc. and reduce the start-up effect.
set order to iOWNERS
for lnI = 1 to 1000
lnKey = int(rand()*100000)
seek lnKey
endfor

lnSeconds = seconds()
for lnI = 1 to lnLoops
seek int(rand()*100000)
endfor
lnSeconds2 = seconds()
? " Using SEEK --" ;
+ str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)

set order to
lnSeconds = seconds()
for lnI = 1 to lnLoops
=seek(int(rand()*100000),"SEEKTEST","iOWNERS")
endfor
lnSeconds2 = seconds()
? " Using SEEK() --" ;
+ str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)

set order to iOWNERS
lnSeconds = seconds()
for lnI = 1 to lnLoops
=seek(int(rand()*100000),"SEEKTEST","iOWNERS")
endfor
lnSeconds2 = seconds()
? " Using SEEK() w ORDER --" ;
+ str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)

set order to
lnSeconds = seconds()
for lnI = 1 to lnLoops
locate for iOWNERS = int(rand()*100000)
endfor
lnSeconds2 = seconds()
? " Using LOCATE --" ;
+ str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)

if lnLoops <= 10000
lnSeconds = seconds()
for lnI = 1 to lnLoops
lnKey = int(rand()*100000)
select cName from SEEKTEST ;
where SEEKTEST.iOWNERS = lnKey ;
into array laName
endfor
lnSeconds2 = seconds()
? " Using SQL SELECT --" ;
+ str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)
endif
Peter Robinson ** Rodes Design ** Virginia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform