Comparing Big Lists
Scott Raney
raney at metacard.com
Tue Apr 30 00:21:07 EDT 2002
On Mon, 29 Apr 2002 Gregory Lypny <gregory.lypny at videotron.ca> wrote:
> I tried your suggestion of turning smallList into an associative
> array with the index for each element equal to the text I'm looking for
> in bigList. I think I must have misunderstood your suggestion because
> the handler runs much slower than previously, perhaps because I've got
> it asking for the keys of smallList for every line of bigList.
Exactly: keys() is a very expensive operation because it has to
traverse the whole structure and pull out specific items and put them
into a new buffer.
> Here's what I tried.
>
> -- Note. smallListArray array is an array made out of the original
> smallList variable
>
> repeat for each line i in bigList
> if item 6 of i keys(smallListArray)
The trick here is that smallListArray will not necessarily have any
data in it, it's the keys that are significant. So just put "x" into
each element when building the array and then check to see if
smallListArray[item 6 of i] is empty as you traverse the big list.
Regards,
Scott
> then
> put i into hitList[item 6 of i]
> end if
> end repeat
********************************************************
Scott Raney raney at metacard.com http://www.metacard.com
MetaCard: You know, there's an easier way to do that...
More information about the metacard
mailing list