Using
mmap will give you the same memory sharing effect as reading everything in one process then forking, as well as being easier to manage, somewhat more efficient to read, and making it easier for your OS to manage the memory (data is only paged in as its needed, and the system's buffer cache can just drop pages if it needs the memory, and get it back from the disk later).
Another possibility is to steal an idea from dbz, which indexes a fixed format text file by using the index values as the keys, and the file offset of the start of the record as values. This is fairly straightforward to do with Berkeley DB. A few well-chosen indexes can make a huge difference, without requiring a full rewrite into a relational database.
So if you used mmap and a dbz-style index together, you'd get the file offset from the DB, then use substr to inspect the mmap'd data at that location.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.