Hello Wise Ones,
I'm running into a problem using non-blocking pipes: The select and can_read methods are taking ~300µs/call (according to NYTProf). Is that normal? It is really killing the performance of my app.
You can see my package at:
http://174.133.216.178/r/BossWorker.pm
I'm new to pipe communication in Perl, so it's very likely that "I'm using it wrong" (yeah, I know, that's what she said)
I'd be happy to take feedback even if it's not related to the performance
Background:
I have re-written the Parallel::Fork::BossWorker (http://search.cpan.org/~twilde/Parallel-Fork-BossWorker-0.05/lib/Parallel/Fork/BossWorker.pm) package to support some features that I think are rather critical:
* Messages larger than the pipe buffer, which is 64K on most platforms. The current implementation silently corrupts the data if it's larger than the buffer.
* Asynchronous processing: The current implementation only supports one big batch of processing. I've added a `progress` sub.
Unfortunately, these features require a complete re-write because the current code exploits a feature of pipes where any messages smaller than the buffer are atomic. So the current code can share pipes and doesn't need to manage buffers.
My test is currently taking 50% longer than the original version, which is exactly the amount of time being spent in using select/can_read.
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.