[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] efficiency & memory



At 20.26 +0200 98-08-21, Mark Manning/Muniz Eng. wrote:
>Actually, now that I've thought about it - wasn't it something like:
>
>	@id = @<something>_array[ sort byID 0..$#id ]; ?

It was:

@sorted = @master_lines[ sort byID  0 .. $#ids];

Nathaniel prepared two arrays - @master_lines with the whole lines, and
@ids with the numbers matched out from the master lines. That is faster
than matching out those numbers in byID.

To summarize, Nathaniel sorts the numbers 0, 1, 2, ... $#ids according to
the id numbers in @ids, and then takes a slice of the @master_lines array,
to get that array sorted in the same order.

>(Like I said - even though I understand what it is that is going on it
>is still a rather strange way (to me) of doing this.)

TIMTOWTDI. The Schwartzian transform would be a more "canonical" way of
doing this.

>But thanks for the explanation!  :-)

Anytime :-)

Cajo.

___Carl_Johan_Berglund_________________________
   Adverb Information
   carl.johan.berglund@adverb.se
   http://www.adverb.se/



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch