Re: Linux::Smaps

Ævar Arnfjörð Bjarmason <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Tue, Mar 29, 2011 at 18:52, Torsten Förtsch <[email protected]> wrote:

> 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%    --

I've just uploaded 0.06 of Linux::Smaps::Tiny. It'll use C XS code to
parse the file by default, falling back to the pure-perl version if
there's no compiler on the system:

    $ perl -Ilib -MLinux::Smaps -MLinux::Smaps::Tiny
-MLinux::Smaps::Tiny::PP     -MBenchmark=:all,:hireswallclock -e '
     cmpthese timethese -5, {
       tiny=>sub{Linux::Smaps::Tiny::get_smaps_summary},
       tiny_pp=>sub{Linux::Smaps::Tiny::PP::__get_smaps_summary},
       smaps=>sub{scalar Linux::Smaps->new->all}
     }
    '
    Benchmark: running smaps, tiny, tiny_pp for at least 5 CPU seconds...
         smaps: 5.3729 wallclock secs ( 4.42 usr +  0.93 sys =  5.35
CPU) @ 792.52/s (n=4240)
          tiny: 5.42358 wallclock secs ( 2.94 usr +  2.46 sys =  5.40
CPU) @ 2082.59/s (n=11246)
       tiny_pp: 5.39001 wallclock secs ( 4.02 usr +  1.36 sys =  5.38
CPU) @ 1029.18/s (n=5537)
              Rate   smaps tiny_pp    tiny
    smaps    793/s      --    -23%    -62%
    tiny_pp 1029/s     30%      --    -51%
    tiny    2083/s    163%    102%      --
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.