Greetings,
I reached my goal in reaching below 2M per worker. Testing involved running 200 workers with and without threads for the MCE demonstration and without threads for MCE::Hobo.
MCE::Flow
use strict;
use warnings;
use threads; # comment out for child processes
use MCE::Flow;
use MCE::Shared;
use Time::HiRes 'time';
my $n = MCE::Shared->scalar(0);
my $s = time;
sub task {
# do something, plenty time to see top
my $v; $v = $n->incr() for 1 .. 933;
}
mce_flow { max_workers => 200 }, \&task;
MCE::Flow::finish;
printf "duration: %0.3f\n", time - $s;
print $n->get(), "\n";
__END__
main process, shared-manager process, and 200 workers
# with threads: e.g. use threads
498M MCE 1.827, MCE::Shared 1.824
437M MCE 1.828, MCE::Shared 1.825 <- big reduction
399M MCE 1.829, MCE::Shared 1.826 <- more reduction
# without threads
MCE 1.829, MCE::Shared 1.826: ~ 1744K per worker
MCE::Hobo
use strict;
use warnings;
use MCE::Hobo;
use MCE::Shared;
use Time::HiRes 'time';
my $n = MCE::Shared->scalar(0);
my $s = time;
sub task {
# do something, plenty time to see top
my $v; $v = $n->incr() for 1 .. 933;
}
MCE::Hobo->create(\&task) for 1 .. 200;
MCE::Hobo->waitall;
printf "duration: %0.3f\n", time - $s;
print $n->get(), "\n";
__END__
main process, shared-manager process, and 200 workers
MCE::Shared 1.826: ~ 1356K per worker
Well, I never imagined for MCE::Hobo to consume less than 1.4M per worker, let alone MCE::Flow running below 2M. MCE 1.829 and MCE::Shared 1.826 will be released later this week.
Regards, Mario
-
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.