Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INDEXSEEK()
Message
From
11/11/2001 19:41:33
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
INDEXSEEK()
Miscellaneous
Thread ID:
00580322
Message ID:
00580322
Views:
58
Initially I thought INDEXSEEK() would be a great command, saving some network load etc by not moving the record pointer, until I realised that it respects SET DELETED and SET FILTER. In which case it HAS to move the record pointer and then move it back. That makes it slower than SEEK()
Since we run with SET DELETED ON in nearly all cases that's sad!

Here's some code that you could modify to test your own files....
local i, t
* Assume RMast is open
set filter to

* NOTE: Rnum=2 is a deleted record and Active=.F.!

t= seconds()
set deleted on
for i = 1 to 100000
	 =seek(2, 'Rmast', 'RNum')
	 go bott
endfor
? 'Old SEEK took ' + str(seconds()-t, 12,2)
* Ave: 1.00

t= seconds()
set deleted on
for i = 1 to 100000
	 indexseek(2, .F., 'Rmast', 'RNum')
	 go bott
endfor
? 'Indexseek DELETED ON took ' + str(seconds()-t, 12,2)
* Ave: 1.06 

t= seconds()
set deleted off
for i = 1 to 100000
	 indexseek(2, .F., 'Rmast', 'RNum')
	 go bott
endfor
? 'Indexseek DELETED OFF took ' + str(seconds()-t, 12,2)
* Ave 0.63

set filter to Active
t= seconds()
set deleted off
for i = 1 to 100000
	 indexseek(2, .F., 'Rmast', 'RNum')
	 go bott
endfor
? 'Indexseek DELETED OFF, FILTER ON took ' + str(seconds()-t, 12,2)
* Ave 1.38
Next
Reply
Map
View

Click here to load this message in the networking platform