And if every worker fork needs to modify 1 bit on every 4x page of 1 GB of shared data, it's gonna take forever.
Rubbish
use strict; use warnings; use 5.010; use Time::HiRes qw(time); my $data = 'x' x 500_000_000; my $t = time; $data =~ tr/x/y/; say time - $t; __END__ 0.469923973083496
use strict; use warnings; use 5.010; use Time::HiRes qw(time); my $data = 'x' x 500_000_000; my $t = time; unless (fork) { $data =~ tr/x/y/; exit; } wait; say time - $t; __END__ 0.765344142913818
use strict; use warnings; use 5.010; use threads; use Time::HiRes qw(time); my $data = 'x' x 500_000_000; my $t = time; threads->create( sub { $data =~ tr/x/y/; } )->join; say time - $t; __END__ 1.29563307762146
In reply to Re^21: Strange memory leak using just threads (forks.pm)
by zwon
in thread Strange memory leak using just threads
by MnkyBrain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |