I personally don't think that /^$/ is more perlish than eq "" is. Neither is a different layout or the use of single quotes versus the use of double quotes or the use of statement modifiers (action if expression) is better or more modern than (expression and action).

Modern perl offers more optimizer paths internally, and that is needed because there are so many ways to address a problem. The best way is the way than gets the job done in a manner that the whole team agrees with and is done in a way that the maintainer 5 years from now can still read. Squeezing out nanoseconds on statements that are only visited once in the lifecycle of a program is useless. If the statement however is visited millions of times it might be worthwhile to bench the effect. And the still, it might be only a vilid optimization on that local machine with that build of perl on that architecture.

I did try your test on the 85 perl builds I have available (all build with the same configuration) and I just noted that threaded perls all came in much slower than unthreaded perls.

rank elapsed cuser csys pass perl perl + rank ==== ========== ======= ======= ==== ================= ============== +=== ==== 1 0.00363 0.000 0.010 FAIL base/perl5.00504 /pro/bin/perl + 19 2 0.00912 0.000 0.000 FAIL base/perl5.00307 /usr/bin/perl + 34 3 0.02307 0.000 0.000 FAIL base/perl5.00503 base/perl5.003 +07 2 4 0.07953 0.000 0.010 FAIL base/perl5.00405 base/perl5.004 +05 4 5 2.61894 2.580 0.010 PASS base/perl5.6.2 base/perl5.005 +03 3 6 2.68016 2.630 0.020 PASS base/perl5.6.1 base/perl5.005 +04 1 7 2.68523 2.660 0.010 PASS base/perl5.6.0 base/perl5.6.0 + 7 8 2.83037 2.800 0.010 PASS base/perl5.8.0 base/perl5.6.1 + 6 9 2.88885 2.720 0.010 PASS base/perl5.8.3 base/tperl5.6. +1 12 10 2.91004 2.720 0.010 PASS base/perl5.8.2 base/perl5.6.2 + 5 11 2.91830 2.750 0.010 PASS base/perl5.8.7 base/tperl5.6. +2 18 12 2.92083 2.900 0.020 PASS base/tperl5.6.1 base/perl5.8.0 + 8 13 2.92413 2.750 0.010 PASS base/perl5.8.8 base/tperl5.8. +0 20 14 2.93176 2.720 0.010 PASS base/perl5.8.5 base/perl5.8.1 + 15 15 2.93800 2.730 0.020 PASS base/perl5.8.1 base/tperl5.8. +1 23 16 2.94319 2.740 0.010 PASS base/perl5.8.4 base/perl5.8.2 + 10 17 2.94600 2.690 0.010 PASS base/perl5.8.6 base/tperl5.8. +2 24 18 3.00963 2.990 0.010 PASS base/tperl5.6.2 base/perl5.8.3 + 9 19 3.06281 3.020 0.020 PASS /pro/bin/perl base/tperl5.8. +3 25 20 3.09148 3.070 0.020 PASS base/tperl5.8.0 base/perl5.8.4 + 16 21 3.10270 2.860 0.040 PASS base/perl5.8.9 base/tperl5.8. +4 27 22 3.17054 3.000 0.020 PASS base/tperl5.8.7 base/perl5.8.5 + 14 23 3.18847 3.010 0.010 PASS base/tperl5.8.1 base/tperl5.8. +5 28 24 3.20540 3.030 0.020 PASS base/tperl5.8.2 base/perl5.8.6 + 17 25 3.24457 3.070 0.000 PASS base/tperl5.8.3 base/tperl5.8. +6 30 26 3.29392 3.110 0.010 PASS base/tperl5.8.8 base/perl5.8.7 + 11 27 3.29553 3.080 0.010 PASS base/tperl5.8.4 base/tperl5.8. +7 22 28 3.30491 3.010 0.010 PASS base/tperl5.8.5 base/perl5.8.8 + 13 29 3.31124 3.030 0.070 PASS base/perl5.10.1 base/tperl5.8. +8 26 30 3.32899 3.090 0.010 PASS base/tperl5.8.6 base/perl5.8.9 + 21 31 3.43455 3.160 0.040 PASS base/perl5.10.0 base/tperl5.8. +9 46 32 3.43906 3.120 0.070 PASS base/perl5.12.0 base/perl5.10. +0 31 33 3.44477 3.110 0.060 PASS base/perl5.13.4 base/tperl5.10 +.0 55 34 3.52390 3.390 0.000 PASS /usr/bin/perl base/perl5.10. +1 29 35 3.52483 3.210 0.020 PASS base/perl5.13.8 base/tperl5.10 +.1 60 36 3.52753 3.250 0.030 PASS base/perl5.13.6 base/perl5.11. +0 52 37 3.54057 3.250 0.010 PASS base/perl5.13.5 base/tperl5.11 +.0 62 38 3.55223 3.320 0.010 PASS base/perl5.14.0 base/perl5.11. +1 56 39 3.55414 3.200 0.080 PASS base/perl5.11.2 base/tperl5.11 +.1 72 40 3.55444 3.120 0.070 PASS base/perl5.13.2 base/perl5.11. +2 39 41 3.57146 3.150 0.070 PASS base/perl5.13.1 base/tperl5.11 +.2 71 42 3.57274 3.260 0.100 PASS base/perl5.14.1 base/perl5.11. +3 51 43 3.59174 3.310 0.060 PASS base/perl5.13.11 base/tperl5.11 +.3 75 44 3.59178 3.200 0.090 PASS base/perl5.12.4 base/perl5.11. +4 45 45 3.59741 3.160 0.060 PASS base/perl5.11.4 base/tperl5.11 +.4 79 46 3.61302 3.240 0.060 PASS base/tperl5.8.9 base/perl5.11. +5 50 47 3.61401 3.300 0.010 PASS base/perl5.12.3 base/tperl5.11 +.5 64 48 3.63592 3.330 0.080 PASS base/perl5.13.10 base/perl5.12. +0 32 49 3.64948 3.290 0.010 PASS base/perl5.12.1 base/tperl5.12 +.0 73 50 3.65347 3.240 0.070 PASS base/perl5.11.5 base/perl5.12. +1 49 51 3.65606 3.220 0.070 PASS base/perl5.11.3 base/tperl5.12 +.1 65 52 3.69079 3.250 0.080 PASS base/perl5.11.0 base/perl5.12. +2 58 53 3.69301 3.260 0.070 PASS base/perl5.13.3 base/tperl5.12 +.2 84 54 3.71434 3.320 0.080 PASS base/perl5.13.9 base/perl5.12. +3 47 55 3.72287 3.460 0.070 PASS base/tperl5.10.0 base/tperl5.12 +.3 82 56 3.72652 3.270 0.090 PASS base/perl5.11.1 base/perl5.12. +4 44 57 3.73024 3.330 0.050 PASS base/perl5.13.7 base/tperl5.12 +.4 85 58 3.75741 3.280 0.090 PASS base/perl5.12.2 base/perl5.13. +0 59 59 3.77567 3.390 0.060 PASS base/perl5.13.0 base/tperl5.13 +.0 77 60 3.88845 3.640 0.000 PASS base/tperl5.10.1 base/perl5.13. +1 41 61 3.95350 3.700 0.050 PASS base/tperl5.13.10 base/tperl5.13 +.1 66 62 3.99173 3.630 0.060 PASS base/tperl5.11.0 base/perl5.13. +2 40 63 3.99887 3.720 0.080 PASS base/tperl5.14.0 base/tperl5.13 +.2 78 64 3.99972 3.690 0.070 PASS base/tperl5.11.5 base/perl5.13. +3 53 65 4.00705 3.730 0.010 PASS base/tperl5.12.1 base/tperl5.13 +.3 80 66 4.02853 3.710 0.080 PASS base/tperl5.13.1 base/perl5.13. +4 33 67 4.04036 3.740 0.020 PASS base/tperl5.13.6 base/tperl5.13 +.4 83 68 4.04658 3.740 0.020 PASS base/tperl5.13.5 base/perl5.13. +5 37 69 4.06868 3.820 0.010 PASS base/tperl5.13.9 base/tperl5.13 +.5 68 70 4.07103 3.870 0.040 PASS base/tperl5.13.11 base/perl5.13. +6 36 71 4.07516 3.700 0.100 PASS base/tperl5.11.2 base/tperl5.13 +.6 67 72 4.09376 3.760 0.060 PASS base/tperl5.11.1 base/perl5.13. +7 57 73 4.11930 3.790 0.030 PASS base/tperl5.12.0 base/tperl5.13 +.7 81 74 4.11944 3.870 0.010 PASS base/tperl5.14.1 base/perl5.13. +8 35 75 4.13039 3.800 0.050 PASS base/tperl5.11.3 base/tperl5.13 +.8 76 76 4.13756 3.750 0.060 PASS base/tperl5.13.8 base/perl5.13. +9 54 77 4.14126 3.860 0.030 PASS base/tperl5.13.0 base/tperl5.13 +.9 69 78 4.14612 3.740 0.070 PASS base/tperl5.13.2 base/perl5.13. +10 48 79 4.16076 3.830 0.080 PASS base/tperl5.11.4 base/tperl5.13 +.10 61 80 4.17469 3.690 0.080 PASS base/tperl5.13.3 base/perl5.13. +11 43 81 4.17835 3.720 0.120 PASS base/tperl5.13.7 base/tperl5.13 +.11 70 82 4.20535 3.820 0.090 PASS base/tperl5.12.3 base/perl5.14. +0 38 83 4.21454 3.880 0.080 PASS base/tperl5.13.4 base/tperl5.14 +.0 63 84 4.21915 3.780 0.100 PASS base/tperl5.12.2 base/perl5.14. +1 42 85 4.23053 3.860 0.010 PASS base/tperl5.12.4 base/tperl5.14 +.1 74

Another point in your post includes the work against databases. In my experience, the database is always slower than your perl script, so the gain of a few microseconds in using a syntax that you like/dislike is lost against milliseconds you loose with every database access.


Enjoy, Have FUN! H.Merijn

In reply to Re: Why "Modern Perl" is slower than "Legacy Perl"? by Tux
in thread Why "Modern Perl" is slower than "Legacy Perl"? by dwalin

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.