Normal Topic Improving xlookup speed (Read 574 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Improving xlookup speed
Aug 18th, 2004 at 2:36pm
Print Post Print Post  
It has often been mentioned that to speed up xlookups it is helpful to add a lookup when the application opens because after the first lookup the rest are very quick.

What is the best way to accomplish this?

One lookup for each database we are retrieving data from?
Is there an advantage to search for something say beginning with A?
Is global code the best place to put them?
Should these lookups be put before any other code? 

Any suggestions will be appreciated.  Smiley


Thanks

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Improving xlookup speed
Reply #1 - Aug 18th, 2004 at 3:52pm
Print Post Print Post  
Quote:
It has often been mentioned that to speed up xlookups it is helpful to add a lookup when the application opens because after the first lookup the rest are very quick.

What is the best way to accomplish this?

If the externally database is frequently used and you have sufficient memory, the best way may be to include that database in your application and use XLookup "internally".
Quote:
One lookup for each database we are retrieving data from?

If you believe the database file will be "lookup'ed" at a time critical moment or frequently, and that database file is external to your current application file, you should have one "early" xlookup for each file.
Quote:
Is there an advantage to search for something say beginning with A?
No - not arbitrarily. A huge advantage can be gained by doing an XLookup that succeeds on a record you know to be early in the file. The worst case is a xlookup that fails to find any matches (because it will need to look at every record of that type).

Quote:
Is global code the best place to put them?

Usually. There is a feature coming in the next release that may provide a better spot.
Quote:
Should these lookups be put before any other code? 

Depends entirely on requirements. But, in many cases - yes.

In general, using an "early" xlookup, does not actually speed anything up, it moves the point in time when the Sesame "loads" that external database file to a moment that won't be bothersome to the user. If, for example, your external file is smallish, it may be fine to have the first xlookup in-line with the normal code that normally calls it. The user might notice a small "hitch", but nothing so bad that it would be a problem. If your external database file is large, by loading it early, you move its more substantial "hitch" to a moment when the user is less sensitive to delay.

If you really need to keep the pedal to the metal, it may be time to consider a lower impact, lower overhead lookup mechanism, such as using GlobalValues, StringArrays, or true arrays. As long as they are kept current, any of these three methods and a bit of creativity will give you much of what xlookup provides, at a higher speed and lower memory consumption.

  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged