Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INDEXSEEK() vs. LOOKUP() 2

Status
Not open for further replies.

SGLong

Programmer
Jun 6, 2000
405
US
I'm always amazed at what I don't know about VFP. In going thru one of our legacy programs I encountered the LOOKUP function, which I never knew existed. I went to the VFP help file to learn more about this command. First I read that it's not Rushmore optimizable, and when I found the example referencing @2,2 SAY LOOKUP... I thought to myself that this is OLD technology.

I'm thinking that switching over to INDEXSEEK would be more efficient and easier to read. In looking thru Source Safe I find lot's of occurances of LOOKUP(). Should I make a pitch to my supervisor to gradually replace this outdated function?

Steve
 
Either replace it with SEEK() or INDEXSEEK() or make sure it's updated to use the correct TAG. I doubt you would see any measurable difference in speed between any of the 3 unless it was in a massive loop situation.

Either SEEK() or INDEXSEEK() are more readable, IMO. But all 3 can take advantage of an index TAG.

Regards,
Jim
 
Jim & Geoff,

Thanks for your feedback. I haven't heard any speed complaints, and I've got enough on my plate that I don't need to dig up things to do. I just have to wonder if relying on old functionality is setting us up for problems in the future.

Steve
 

In thread182-1158886, in the post dated 20-Dec-05 19:06, Mike Yearwood mentioned that
“One of the things I wish they would not mention as being not optimizable is LOOKUP(). Using that function with the 4th parameter is probably one of the fastest SEEKs available, if you need to return a value. All that LOOKUP does cannot be beat by corresponding VFP code.

I didn’t find time to check myself so far, but thought it might be of interest to you.
 
Mike Yearwood is right.

Fox Software really shot themselves in the foot with that comment about Lookup() not being optimized. It scares everyone away from that function.

If you use the index tag parameter, it does a SEEK which DOESN'T NEED optimization. ;-)
 

Thanks, danfreeman.

If you use the index tag parameter, it does a SEEK which DOESN'T NEED optimization. ;-)

That's about what I said in the mentioned thread:
Maybe it's not optimizable because it's already optimal? :-D

So it probably is.
 
Thanks all... Stella, that find deserves a star. I think I'll leave the original code I found alone because it's doing as it was intended - returning a single piece of data for the screen.

Steve
 

Thanks, Steve, but in this case, it was not actually a find on my part - I just quoted Mike Yearwood from the thread in which I recently participated, too. I think he deserves a star, too. May I?
 
Stella,

Be my guest... Although you did credit his thread, I gave you the star because you pointed me to it.

Steve
 

Thanks. I understand. I got a star once for pointing someone to a less known Tek-Tips forum. I also give stars to the messenger sometimes.:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top