In the context of this discussion, it is worth repeating the thread usage discussion in "perldoc perlthrtut". I have emphasized the primary usage directive, which explains the "right" way to use threads with the current implementation (5.8).
Performance considerations
The main thing to bear in mind when comparing ithreads to other
threading models is the fact that for each new thread created, a
complete copy of all the variables and data of the parent thread has to
be taken. Thus thread creation can be quite expensive, both in terms of
memory usage and time spent in creation. The ideal way to reduce these
costs is to have a relatively short number of long-lived threads, all
created fairly early on - before the base thread has accumulated too
much data. Of course, this may not always be possible, so compromises
have to be made. However, after a thread has been created, its
performance and extra memory usage should be little different than
ordinary code.
Also note that under the current implementation, shared variables use a
little more memory and are a little slower than ordinary variables.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|