On Fri, Nov 12, 2004 at 02:11:37AM -0500, Aaron Sherman wrote:
> Seriously, while mmap is ideal in C, in Perl I would just build an array
> of tell()s for each line in the file and then walk through the lines,
> storing the offset of the last delimiter that I'd seen.

I think mmap would be just as ideal in Perl and a lot less work too.
Rather than indexing and parsing a *large* file, you must mmap
and parse it. In fact, the CSV code, which was left as an exercise in you
pseudo-code, would be the only code required.

I should point out though that mmap has a 2GB limit on systems
without 64bit support. Such systems can't store files larger than
that anyhow.

> Let the kernel file buffer do your heavy lifting for you.

Exactly, if s/kernel file/mmap/

-Gyepi

--
The convenient method is insecure and the secure method is inconvenient.
--me
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to