In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/607ee43568c28c8da9fb4b19d16807dd0214af40?hp=850e14d313dc5493e5162c407f21ae0a9fec2805>

- Log -----------------------------------------------------------------
commit 607ee43568c28c8da9fb4b19d16807dd0214af40
Author: James Raspass <[email protected]>
Date:   Wed Jul 15 23:46:20 2015 +0100

    Speed up compilation of overload.pm a smidge.
    
    Measured with the following crude perl script calling perf. Perl
    is in there to get a rough baseline cost of starting perl:
    
     print 'PERL', (`perf stat -r100 perl -e 1             2>&1`)[10];
     print 'OLD ', (`perf stat -r100 perl lib/overload.pm  2>&1`)[10];
     print 'NEW ', (`perf stat -r100 perl lib/overload2.pm 2>&1`)[10];
    
    Produced the following results on my machine:
    
     PERL  5,800,051 instructions # 1.05 insns per cycle ( +- 0.06% )
     OLD  14,818,995 instructions # 1.16 insns per cycle ( +- 0.03% )
     NEW  14,696,974 instructions # 1.16 insns per cycle ( +- 0.03% )
    
    While the numbers did fluctuate between runs, the new code was
    consistently faster.
-----------------------------------------------------------------------

Summary of changes:
 lib/overload.pm | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/overload.pm b/lib/overload.pm
index 4a1912c..758b67d 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -1,6 +1,6 @@
 package overload;
 
-our $VERSION = '1.26';
+our $VERSION = '1.27';
 
 %ops = (
     with_assign         => "+ - * / % ** << >> x .",
@@ -21,9 +21,7 @@ our $VERSION = '1.26';
 );
 
 my %ops_seen;
-for $category (keys %ops) {
-    $ops_seen{$_}++ for (split /\s+/, $ops{$category});
-}
+@ops_seen{ map split(/ /), values %ops } = ();
 
 sub nil {}
 
@@ -40,7 +38,7 @@ sub OVERLOAD {
       }
     } else {
       warnings::warnif("overload arg '$_' is invalid")
-        unless $ops_seen{$_};
+        unless exists $ops_seen{$_};
       $sub = $arg{$_};
       if (not ref $sub) {
        $ {$package . "::(" . $_} = $sub;

--
Perl5 Master Repository

Reply via email to