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

Re: [MacPerl] Searching a VERY large text file



|>I think that, if you read in the data via sysread/read in blocks of,
|>say, 32k, and scan those, you might get a decent speed incease.
|I agree with Bart.  The following subroutine shows how I'd code the search.

Note that when you read line by line, the input is already buffered, so
all you're really doing is increasing the size of the buffer, and doing
the buffer management in Perl instead of C.

If you're really worried about speed, you'll get *far* more improvement
by dumping the silly linear search and either doing a binary search on
the text file or converting the text file to a DBM file and searching
using that.

As this never really had anything to do with MacPerl, I suggest the
discussion be continued in a perl or algorithms newsgroup instead of
here.

Brian

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