Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed of SEEK, SEEK(), LOCATE, and SQL SELECT
Message
De
29/06/1999 11:24:50
 
 
À
29/06/1999 09:45:14
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00235086
Message ID:
00235287
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform