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

Re: [MacPerl] Searching a VERY large text file



At 05.36 98.02.05, Shyam Hegde wrote:
>>open(F, 'file') || die $!;
>>while(<F>) {
>>  print if /match this text/;
>>}
>>close(F);

>This is basically the way I ended up coding it last night - it is faster
>and requires less RAM than the 'opening file and shove into array method',
>although it can still be slowish if the item it is looking for is located
>near the EOF.

Yep.

>Is there some way of compiling MacPerl scripts into machine language or
>converting them into C/C++ routines that I could then read into
>CodeWarrior... Maybe this would increase speed - then again maybe not??

It depends on your data and its use.  If the text you are searching for is
always at the beginning of the string and the file is in dictionary order,
you can use Search::Dict which does a binary search.  If you will be doing
lots of searches on the data and you can isolate the data you are searching
on into a specific key, then compiling into a DBM with DB_File is the
fastest.  But it all depends on the specifics of your data.  There is no
one single answer.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==       New Book: MacPerl:  Programming for the Rest of Us       ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



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