Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

That performance difference seems to be consistent accross all perl versions. I ran the following through 79 perl versions

use strict; use Benchmark qw(cmpthese); my $a1 = "a" x 1e6; my $b1 = 12345; cmpthese 2000000, { "und" => q[ sub{ my (undef, $x) = @_ }->($a1, $b1) ], "skp" => q[ sub{ my $x = $_[1] }->($a1, $b1) ], "var" => q[ sub{ my ($unused, $x) = @_;}->($a1, $b1) ], };

I note that 5.13.8 unthreaded is a weird reproducible result:

Rate var und skp var 1694915/s -- -27% -41% und 2325581/s 37% -- -19% skp 2857143/s 69% 23% --
=== base/perl5.00307 5.00307 i686-linux Missing $ on loop variable at /media/Tux/perls/lib/strict.pm line 90. BEGIN failed--compilation aborted at abc.pl line 1. Exit status: 512 === base/perl5.00405 5.00405 i686-linux "cmpthese" is not exported by the Benchmark module at abc.pl line 3 Can't continue after import errors at abc.pl line 3 BEGIN failed--compilation aborted at abc.pl line 3. Exit status: 65280 === base/perl5.00503 5.00503 i686-linux Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.60 usr + 0.00 sys = 0.60 CPU) @ 33 +33333.33/s (n=2000000) und: 1 wallclock secs ( 0.79 usr + 0.00 sys = 0.79 CPU) @ 25 +31645.57/s (n=2000000) var: 0 wallclock secs ( 0.86 usr + 0.00 sys = 0.86 CPU) @ 23 +25581.40/s (n=2000000) Rate var und skp var 2325581/s -- -8% -30% und 2531646/s 9% -- -24% skp 3333333/s 43% 32% -- === base/perl5.00504 5.00504 i686-linux Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.72 usr + 0.00 sys = 0.72 CPU) @ 27 +77777.78/s (n=2000000) und: 1 wallclock secs ( 0.91 usr + 0.00 sys = 0.91 CPU) @ 21 +97802.20/s (n=2000000) var: 1 wallclock secs ( 1.00 usr + 0.00 sys = 1.00 CPU) @ 20 +00000.00/s (n=2000000) Rate var und skp var 2000000/s -- -9% -28% und 2197802/s 10% -- -21% skp 2777778/s 39% 26% -- === base/perl5.6.0 5.006 i686-linux-64int Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.58 usr + 0.00 sys = 0.58 CPU) @ 34 +48275.86/s (n=2000000) und: 1 wallclock secs ( 0.76 usr + 0.00 sys = 0.76 CPU) @ 26 +31578.95/s (n=2000000) var: 1 wallclock secs ( 0.90 usr + 0.00 sys = 0.90 CPU) @ 22 +22222.22/s (n=2000000) Rate var und skp var 2222222/s -- -16% -36% und 2631579/s 18% -- -24% skp 3448276/s 55% 31% -- === base/perl5.6.1 5.006001 i686-linux-64int-perlio Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.68 usr + 0.00 sys = 0.68 CPU) @ 29 +41176.47/s (n=2000000) und: 0 wallclock secs ( 0.84 usr + 0.00 sys = 0.84 CPU) @ 23 +80952.38/s (n=2000000) var: 1 wallclock secs ( 0.93 usr + 0.00 sys = 0.93 CPU) @ 21 +50537.63/s (n=2000000) Rate var und skp var 2150538/s -- -10% -27% und 2380952/s 11% -- -19% skp 2941176/s 37% 24% -- === base/tperl5.6.1 5.006001 i686-linux-thread-multi-64int-ld-perl +io Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.71 usr + 0.00 sys = 0.71 CPU) @ 28 +16901.41/s (n=2000000) und: 2 wallclock secs ( 0.95 usr + 0.00 sys = 0.95 CPU) @ 21 +05263.16/s (n=2000000) var: 1 wallclock secs ( 1.04 usr + 0.00 sys = 1.04 CPU) @ 19 +23076.92/s (n=2000000) Rate var und skp var 1923077/s -- -9% -32% und 2105263/s 9% -- -25% skp 2816901/s 46% 34% -- === base/perl5.6.2 5.006002 i686-linux-64int-perlio Benchmark: timing 2000000 iterations of skp, und, var... skp: -1 wallclock secs ( 0.71 usr + 0.00 sys = 0.71 CPU) @ 28 +16901.41/s (n=2000000) und: 0 wallclock secs ( 0.88 usr + 0.00 sys = 0.88 CPU) @ 22 +72727.27/s (n=2000000) var: 1 wallclock secs ( 0.95 usr + 0.00 sys = 0.95 CPU) @ 21 +05263.16/s (n=2000000) Rate var und skp var 2105263/s -- -7% -25% und 2272727/s 8% -- -19% skp 2816901/s 34% 24% -- === base/tperl5.6.2 5.006002 i686-linux-thread-multi-64int-ld-perl +io Benchmark: timing 2000000 iterations of skp, und, var... skp: 0 wallclock secs ( 0.74 usr + 0.00 sys = 0.74 CPU) @ 27 +02702.70/s (n=2000000) und: 1 wallclock secs ( 0.96 usr + 0.00 sys = 0.96 CPU) @ 20 +83333.33/s (n=2000000) var: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 18 +69158.88/s (n=2000000) Rate var und skp var 1869159/s -- -10% -31% und 2083333/s 11% -- -23% skp 2702703/s 45% 30% -- === base/perl5.8.0 5.008 i686-linux-64int Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.69 usr + 0.00 sys = 0.69 CPU) @ 28 +98550.72/s (n=2000000) und: 1 wallclock secs ( 0.88 usr + 0.00 sys = 0.88 CPU) @ 22 +72727.27/s (n=2000000) var: 2 wallclock secs ( 1.02 usr + 0.00 sys = 1.02 CPU) @ 19 +60784.31/s (n=2000000) Rate var und skp var 1960784/s -- -14% -32% und 2272727/s 16% -- -22% skp 2898551/s 48% 28% -- === base/tperl5.8.0 5.008 i686-linux-thread-multi-64int-ld Benchmark: timing 2000000 iterations of skp, und, var... skp: 1 wallclock secs ( 0.81 usr + 0.00 sys = 0.81 CPU) @ 24 +69135.80/s (n=2000000) und: 0 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU) @ 18 +86792.45/s (n=2000000) var: 2 wallclock secs ( 1.19 usr + 0.00 sys = 1.19 CPU) @ 16 +80672.27/s (n=2000000) Rate var und skp var 1680672/s -- -11% -32% und 1886792/s 12% -- -24% skp 2469136/s 47% 31% -- === base/perl5.8.1 5.008001 i686-linux-64int Rate var und skp var 1834862/s -- -18% -33% und 2247191/s 22% -- -18% skp 2739726/s 49% 22% -- === base/tperl5.8.1 5.008001 i686-linux-thread-multi-64int-ld Rate var und skp var 1724138/s -- -7% -30% und 1851852/s 7% -- -25% skp 2469136/s 43% 33% -- === base/perl5.8.2 5.008002 i686-linux-64int Rate var und skp var 2040816/s -- -11% -29% und 2298851/s 13% -- -20% skp 2857143/s 40% 24% -- === base/tperl5.8.2 5.008002 i686-linux-thread-multi-64int-ld Rate var und skp var 1801802/s -- -11% -29% und 2020202/s 12% -- -20% skp 2531646/s 41% 25% -- === base/perl5.8.3 5.008003 i686-linux-64int Rate var und skp var 1785714/s -- -12% -37% und 2040816/s 14% -- -28% skp 2816901/s 58% 38% -- === base/tperl5.8.3 5.008003 i686-linux-thread-multi-64int-ld Rate var und skp var 1709402/s -- -14% -32% und 1980198/s 16% -- -21% skp 2500000/s 46% 26% -- === base/perl5.8.4 5.008004 i686-linux-64int Rate var und skp var 1886792/s -- -16% -30% und 2247191/s 19% -- -17% skp 2702703/s 43% 20% -- === base/tperl5.8.4 5.008004 i686-linux-thread-multi-64int-ld Rate var und skp var 1694915/s -- -13% -30% und 1941748/s 15% -- -19% skp 2409639/s 42% 24% -- === base/perl5.8.5 5.008005 i686-linux-64int Rate var und skp var 1980198/s -- -14% -23% und 2298851/s 16% -- -10% skp 2564103/s 29% 12% -- === base/tperl5.8.5 5.008005 i686-linux-thread-multi-64int-ld Rate var und skp var 1639344/s -- -10% -29% und 1818182/s 11% -- -21% skp 2298851/s 40% 26% -- === base/perl5.8.6 5.008006 i686-linux-64int Rate var und skp var 1739130/s -- -4% -34% und 1818182/s 5% -- -31% skp 2631579/s 51% 45% -- === base/tperl5.8.6 5.008006 i686-linux-thread-multi-64int-ld Rate var und skp var 1574803/s -- -13% -25% und 1818182/s 15% -- -14% skp 2105263/s 34% 16% -- === base/perl5.8.7 5.008007 i686-linux-64int Rate var und skp var 2000000/s -- -14% -28% und 2325581/s 16% -- -16% skp 2777778/s 39% 19% -- === base/tperl5.8.7 5.008007 i686-linux-thread-multi-64int-ld Rate var und skp var 1754386/s -- -13% -24% und 2020202/s 15% -- -12% skp 2298851/s 31% 14% -- === base/perl5.8.8 5.008008 i686-linux-64int Rate var und skp var 1960784/s -- -10% -25% und 2173913/s 11% -- -17% skp 2631579/s 34% 21% -- === base/tperl5.8.8 5.008008 i686-linux-thread-multi-64int-ld Rate var und skp var 1600000/s -- -12% -32% und 1818182/s 14% -- -23% skp 2352941/s 47% 29% -- === base/perl5.8.9 5.008009 i686-linux-64int Rate var und skp var 1769912/s -- -9% -27% und 1941748/s 10% -- -19% skp 2409639/s 36% 24% -- === base/tperl5.8.9 5.008009 i686-linux-thread-multi-64int-ld Rate var und skp var 1639344/s -- -12% -25% und 1869159/s 14% -- -14% skp 2173913/s 33% 16% -- === base/perl5.10.0 5.010000 i686-linux-64int Rate var und skp var 1515152/s -- -14% -38% und 1754386/s 16% -- -28% skp 2439024/s 61% 39% -- === base/tperl5.10.0 5.010000 i686-linux-thread-multi-64int-ld Rate var und skp var 1459854/s -- -15% -34% und 1709402/s 17% -- -22% skp 2197802/s 51% 29% -- === base/perl5.10.1 5.010001 i686-linux-64int Rate var und skp var 1724138/s -- -15% -29% und 2020202/s 17% -- -17% skp 2439024/s 41% 21% -- === base/tperl5.10.1 5.010001 i686-linux-thread-multi-64int-ld Rate var und skp var 1694915/s -- -9% -25% und 1869159/s 10% -- -18% skp 2272727/s 34% 22% -- === base/perl5.11.0 5.011000 i686-linux-64int Rate var und skp var 1754386/s -- -14% -32% und 2040816/s 16% -- -21% skp 2597403/s 48% 27% -- === base/tperl5.11.0 5.011000 i686-linux-thread-multi-64int-ld Rate var und skp var 1639344/s -- -11% -27% und 1851852/s 13% -- -18% skp 2247191/s 37% 21% -- === base/perl5.11.1 5.011001 i686-linux-64int Rate var und skp var 1801802/s -- -14% -32% und 2105263/s 17% -- -21% skp 2666667/s 48% 27% -- === base/tperl5.11.1 5.011001 i686-linux-thread-multi-64int-ld Rate var und skp var 1818182/s -- -16% -30% und 2173913/s 20% -- -16% skp 2597403/s 43% 19% -- === base/perl5.11.2 5.011002 i686-linux-64int Rate var und skp var 1851852/s -- -18% -29% und 2247191/s 21% -- -13% skp 2597403/s 40% 16% -- === base/tperl5.11.2 5.011002 i686-linux-thread-multi-64int-ld Rate var und skp var 1739130/s -- -7% -23% und 1869159/s 7% -- -18% skp 2272727/s 31% 22% -- === base/perl5.11.3 5.011003 i686-linux-64int Rate var und skp var 1851852/s -- -15% -30% und 2173913/s 17% -- -17% skp 2631579/s 42% 21% -- === base/tperl5.11.3 5.011003 i686-linux-thread-multi-64int-ld Rate var und skp var 1724138/s -- -9% -22% und 1904762/s 10% -- -13% skp 2197802/s 27% 15% -- === base/perl5.11.4 5.011004 i686-linux-64int Rate var und skp var 1754386/s -- -19% -31% und 2173913/s 24% -- -14% skp 2531646/s 44% 16% -- === base/tperl5.11.4 5.011004 i686-linux-thread-multi-64int-ld Rate var und skp var 1754386/s -- -12% -26% und 2000000/s 14% -- -16% skp 2380952/s 36% 19% -- === base/perl5.11.5 5.011005 i686-linux-64int Rate var und skp var 1818182/s -- -15% -29% und 2150538/s 18% -- -16% skp 2564103/s 41% 19% -- === base/tperl5.11.5 5.011005 i686-linux-thread-multi-64int-ld Rate var und skp var 1612903/s -- -2% -31% und 1652893/s 2% -- -29% skp 2325581/s 44% 41% -- === base/perl5.12.0 5.012000 i686-linux-64int Rate var und skp var 1851852/s -- -18% -29% und 2247191/s 21% -- -13% skp 2597403/s 40% 16% -- === base/tperl5.12.0 5.012000 i686-linux-thread-multi-64int-ld Rate var und skp var 1739130/s -- -10% -26% und 1923077/s 11% -- -18% skp 2352941/s 35% 22% -- === base/perl5.12.1 5.012001 i686-linux-64int Rate var und skp var 1869159/s -- -13% -26% und 2150538/s 15% -- -15% skp 2531646/s 35% 18% -- === base/tperl5.12.1 5.012001 i686-linux-thread-multi-64int-ld Rate und var skp und 1680672/s -- -3% -29% var 1724138/s 3% -- -28% skp 2380952/s 42% 38% -- === base/perl5.12.2 5.012002 i686-linux-64int Rate var und skp var 1785714/s -- -15% -32% und 2105263/s 18% -- -20% skp 2631579/s 47% 25% -- === base/tperl5.12.2 5.012002 i686-linux-thread-multi-64int-ld Rate var und skp var 1666667/s -- -2% -32% und 1694915/s 2% -- -31% skp 2439024/s 46% 44% -- === base/perl5.12.3 5.012003 i686-linux-64int Rate var und skp var 1834862/s -- -11% -25% und 2061856/s 12% -- -15% skp 2439024/s 33% 18% -- === base/tperl5.12.3 5.012003 i686-linux-thread-multi-64int-ld Rate var und skp var 1709402/s -- -13% -26% und 1960784/s 15% -- -15% skp 2298851/s 34% 17% -- === base/perl5.13.0 5.013000 i686-linux-64int Rate var und skp var 1886792/s -- -14% -37% und 2197802/s 16% -- -26% skp 2985075/s 58% 36% -- === base/tperl5.13.0 5.013000 i686-linux-thread-multi-64int-ld Rate var und skp var 1754386/s -- -13% -28% und 2020202/s 15% -- -17% skp 2439024/s 39% 21% -- === base/perl5.13.1 5.013001 i686-linux-64int Rate var und skp var 1785714/s -- -18% -39% und 2173913/s 22% -- -26% skp 2941176/s 65% 35% -- === base/tperl5.13.1 5.013001 i686-linux-thread-multi-64int-ld Rate var und skp var 1724138/s -- -6% -27% und 1834862/s 6% -- -22% skp 2352941/s 36% 28% -- === base/perl5.13.2 5.013002 i686-linux-64int Rate var und skp var 1960784/s -- -18% -28% und 2380952/s 21% -- -13% skp 2739726/s 40% 15% -- === base/tperl5.13.2 5.013002 i686-linux-thread-multi-64int-ld Rate var und skp var 1680672/s -- -12% -25% und 1904762/s 13% -- -15% skp 2247191/s 34% 18% -- === base/perl5.13.3 5.013003 i686-linux-64int Rate var und skp var 1801802/s -- -23% -42% und 2352941/s 31% -- -25% skp 3125000/s 73% 33% -- === base/tperl5.13.3 5.013003 i686-linux-thread-multi-64int-ld Rate var und skp var 1538462/s -- -15% -28% und 1818182/s 18% -- -15% skp 2150538/s 40% 18% -- === base/perl5.13.4 5.013004 i686-linux-64int Rate var und skp var 2020202/s -- -21% -28% und 2564103/s 27% -- -9% skp 2816901/s 39% 10% -- === base/tperl5.13.4 5.013004 i686-linux-thread-multi-64int-ld Rate var und skp var 1612903/s -- -13% -27% und 1851852/s 15% -- -17% skp 2222222/s 38% 20% -- === base/perl5.13.5 5.013005 i686-linux-64int Rate var und skp var 1904762/s -- -13% -33% und 2197802/s 15% -- -23% skp 2857143/s 50% 30% -- === base/tperl5.13.5 5.013005 i686-linux-thread-multi-64int-ld Rate var und skp var 1652893/s -- -12% -30% und 1886792/s 14% -- -20% skp 2352941/s 42% 25% -- === base/perl5.13.6 5.013006 i686-linux-64int Rate var und skp var 1801802/s -- -16% -26% und 2150538/s 19% -- -12% skp 2439024/s 35% 13% -- === base/tperl5.13.6 5.013006 i686-linux-thread-multi-64int-ld Rate var und skp var 1694915/s -- -13% -27% und 1941748/s 15% -- -17% skp 2325581/s 37% 20% -- === base/perl5.13.7 5.013007 i686-linux-64int Rate var und skp var 1886792/s -- -15% -30% und 2222222/s 18% -- -18% skp 2702703/s 43% 22% -- === base/tperl5.13.7 5.013007 i686-linux-thread-multi-64int-ld Rate var und skp var 1600000/s -- -12% -26% und 1818182/s 14% -- -16% skp 2173913/s 36% 20% -- === base/perl5.13.8 5.013008 i686-linux-64int Rate var und skp var 1652893/s -- -27% -43% und 2272727/s 37% -- -22% skp 2898551/s 75% 28% -- === base/tperl5.13.8 5.013008 i686-linux-thread-multi-64int-ld Rate var und skp var 1626016/s -- -13% -30% und 1869159/s 15% -- -20% skp 2325581/s 43% 24% -- === base/perl5.13.9 5.013009 i686-linux-64int Rate var und skp var 1941748/s -- -13% -35% und 2222222/s 14% -- -26% skp 2985075/s 54% 34% -- === base/tperl5.13.9 5.013009 i686-linux-thread-multi-64int-ld Rate var und skp var 1526718/s -- -10% -21% und 1694915/s 11% -- -13% skp 1941748/s 27% 15% -- === base/perl5.13.10 5.013010 i686-linux-64int Rate var und skp var 1886792/s -- -17% -29% und 2272727/s 20% -- -15% skp 2666667/s 41% 17% -- === base/tperl5.13.10 5.013010 i686-linux-thread-multi-64int-ld Rate var und skp var 1724138/s -- -10% -26% und 1923077/s 12% -- -17% skp 2325581/s 35% 21% -- === base/perl5.13.11 5.013011 i686-linux-64int Rate var und skp var 2000000/s -- -18% -21% und 2439024/s 22% -- -4% skp 2531646/s 27% 4% -- === base/tperl5.13.11 5.013011 i686-linux-thread-multi-64int-ld Rate var und skp var 1709402/s -- -10% -27% und 1904762/s 11% -- -19% skp 2352941/s 38% 24% -- === /usr/bin/perl 5.012001 i586-linux-thread-multi Rate var und skp var 1694915/s -- -18% -31% und 2061856/s 22% -- -16% skp 2469136/s 46% 20% -- === /pro/bin/perl 5.012002 i686-linux-64int-ld Rate var und skp var 2380952/s -- -18% -30% und 2898551/s 22% -- -14% skp 3389831/s 42% 17% --

Enjoy, Have FUN! H.Merijn

In reply to Re^3: Is undef list assignment a no-op? by Tux
in thread Is undef list assignment a no-op? by repellent

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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 or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2021-10-22 18:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (85 votes). Check out past polls.

    Notices?