Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl
Linux::Smaps
 

Index | Next | Previous | View Flat


torsten.foertsch at gmx

Mar 29, 2011, 9:52 AM


Views: 518
Permalink
Linux::Smaps

Hi,

after having been told by Ævar that Linux::Smaps is really slow I tuned it a
bit. Here is what I get. "new" is version 0.07, "old" is 0.06:

perl -MBenchmark=:all,:hireswallclock -MData::Dumper -e '
sub tm {
my ($title)=@_;
if( my $pid=open my $fh, "-|" ) {
local $/;
my $s=readline $fh;
$s=~s/\A(.+\n)//;
print $1;
my $VAR1;
return eval $s;
} else {
require Linux::Smaps;
print Dumper +timethis -20, sub {Linux::Smaps->new->all}, $title;
exit 0;
}
}
my %res=(old=>tm "old");
unshift @INC, "lib";
$res{new}=tm "new"; cmpthese \%res
'
old: 20.9829 wallclock secs (20.49 usr + 0.45 sys = 20.94 CPU) @ 70.87/s (n=1484)
new: 21.0381 wallclock secs (19.09 usr + 1.92 sys = 21.01 CPU) @ 322.42/s (n=6774)
Rate old new
old 70.9/s -- -78%
new 322/s 355% --

Meanwhile Ævar uploaded his own quite specialized smaps parser
(Linux::Smaps::Tiny) to CPAN. Here is what I get in comparison:

perl -Ilib -MLinux::Smaps -MLinux::Smaps::Tiny \
-MBenchmark=:all,:hireswallclock -e '
cmpthese timethese -5, {
tiny=>sub{Linux::Smaps::Tiny::get_smaps_summary},
smaps=>sub{scalar Linux::Smaps->new->all}
}
'
Benchmark: running smaps, tiny for at least 5 CPU seconds...
smaps: 5.0982 wallclock secs ( 4.56 usr + 0.47 sys = 5.03 CPU) @ 365.81/s (n=1840)
tiny: 5.51047 wallclock secs ( 4.63 usr + 0.83 sys = 5.46 CPU) @ 591.58/s (n=3230)
Rate smaps tiny
smaps 366/s -- -38%
tiny 592/s 62% --

Torsten Förtsch

--
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net

Subject User Time
Linux::Smaps torsten.foertsch at gmx Mar 29, 2011, 9:52 AM
    Re: Linux::Smaps avarab at gmail Apr 3, 2011, 12:30 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.