Hi,
I am trying to parse a large (4.1 GB) file.
In a nutshell, I accept input via STDIN (for illustration purposes, let's say, cat file | script.pl) and
the perl script takes each line, does black magic to it,
and outputs it to a file.
it is taking too long to do this. After weeks and weeks
of trying various ways of speeding things up,
I think at this point, the fastest way to accomplish what I am doing is to read in STDIN, and throw the lines out to multiple workers. I don't know if this would be expressed
as being "threaded" or fork'd. So STDIN to boss, lines are given to X number of workers, and as each comes back, it prints to the file, and is given the next line. One condition I have is that the lines have to be output to the file in the order they came in.
I think this is possible, but my perl-fu is very, very weak, and searching for this on google for days has left me weary. I have found things that are close, and have gotten very close. I think though that i will collapse from exhaustion, or have a mental breakdown if I don't reach out for help :-)
Thank you.
p.s. I know there is no code here, and no sample data or anything like that. I don't want to get wrapped around the axle on semantics or stylistic differences in regular expressions optimization or anything like that :-)
The input data is not overly complex (say, 100 ascii characters) and the output data is not overly complex (again ~100 ascii characters) no binary data or anything weird like that. If anyone feels exact specifics are necessary than I will happily provide anything required.
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.