Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LOCATE x GO TOP
Message
From
01/11/2005 16:03:40
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
LOCATE x GO TOP
Environment versions
Visual FoxPro:
VFP 7 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01064195
Message ID:
01064195
Views:
77
in VFP's Help We can find :
"If you use the LOCATE command without the FOR expression, Visual FoxPro
positions the record pointer at the first logical record. This is faster
than using GO TOP when a filter is in use or when DELETED is ON."


For my curiosity, I wanted to know how much faster LOCATE is, but I got the opposite !
Is the information provided by MS wrong , or did I make the test incorectly ???

TEST 1
SET DELETED ON
SET ORDER TO 1
USING LOCATE : 42.76 SECONDS
USING GOTOP : 22.51 SECONDS


TEST 2
SET DELETED ON
SET ORDER TO
USING LOCATE : 30.03 SECONDS
USING GOTOP : 7.89 SECONDS


TEST 3
SET DELETED OFF
SET ORDER TO 1
USING LOCATE : 26.15 SECONDS
USING GOTOP : 22.53 SECONDS


TEST 4
SET DELETED OFF
SET ORDER TO
USING LOCATE : 13.48 SECONDS
USING GOTOP : 7.82 SECONDS




The code I run is :
CLOSE ALL
CLEAR ALL
CLEAR EVENTS 
SET DELETED OFF && ON

USE myTable
SET ORDER TO 1 
nSecs = SECONDS()
FOR n = 1 TO 10000000
   GO BOTTOM
   GO TOP 
NEXT
MESSAGEBOX(TRANSFORM(SECONDS() - nSecs ) +  " Seconds")
I just alternate SET DELETED and SET ORDER.

Regards

Cesar
Next
Reply
Map
View

Click here to load this message in the networking platform