× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am curious if removing the K from the F-spec would make a difference i
performance that is more noticeable than a faster %Lookup?


(I won't even mention using Matching records and Primary/secondary.) 
 
 
 
---------------------------------------------------------
Booth Martin   http://www.MartinVT.com
Booth@xxxxxxxxxxxx
---------------------------------------------------------
 
-------Original Message-------
 
From: RPG programming on the AS400 / iSeries
Date: Thursday, June 19, 2003 2:06:54 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: lookups and performance
 
Richard B Baird wrote:
> hey all,
> 
> i'm trying to trim a few microseconds per record off of my weekly 2
million
> record update.
> 
> I've loaded a conversion table into two field array / data structure - the
> table is several hundred records.
> 
> this is how I coded the array:
> 
> D DS
> D $items dim(9999) ascend
> D $aItem like(AITEM) overlay($items:1) inz(0)
> D $pItem like(PITEM) overlay($items:*next)
> inz(0)
> 
> and my lookup looks like this:
> 
> C eval $dx = %lookup(CITEMNUM:$aItem:$look1)
> 
> C if $dx > 0
> C eval CITEMNUM = $pItem($dx)
> C end
> 
> ... 
> 
> here are my questions:
> 
> 1. would the lookup be faster if I changed it to a table %tlookup rather
> than a paired field array %lookup?
 
Probably not.
 
> 
> 2. does my example above still do a binary search (which i assume is
> faster) even though the array argument of my lookup bif is only part of
the
> array ds which doesn't have the ascend keyword, while the DIMmed field has
> the ascend keyword?
 
The OVERLAY subfields inherit the sequence attribute of the parent. 
So yes, a %LOOKUP on $AITEM will use a binary search. (Fortunately, 
$AITEM is at the beginning of the array element. A %LOOKUP on $PITEM 
would prpbably fail since the elements are probably not in ordered 
sequence.)
 
If shaving a few microseconds off your job is important, you could 
try profiling a search using the C run-time library function 
"bsearch()". There are three possibilities: It could be faster, it 
oculd be slower, or perhaps there's no measurable difference. Only 
your performance testing and analysis can give you a definite answer.
 
Cheers! Hans
 
 
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
 
. 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.