diff options
author | demerphq <demerphq@gmail.com> | 2009-10-15 14:27:30 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-10-15 14:27:30 +0100 |
commit | 867fa1e2da145229b4db2c6e8d5b51700c15f114 (patch) | |
tree | 83fd35002b63cf9db21ebf85cfa939ebaa370f1b /opcode.h | |
parent | 1c85afcecc8ee030e2780aa5bfa85692c8db64df (diff) | |
download | perl-867fa1e2da145229b4db2c6e8d5b51700c15f114.tar.gz |
Optimise if (%foo) to be faster than if(keys %foo)
Thread was "[PATCH] Make if (%hash) {} act the same as if (keys %hash) {}"
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg00432.html
but the implementation evolved from the approach described in the subject, to
instead add a new opcode pp_boolkeys, to exactly preserve the existing
behaviour.
Various conflicts with the passage of time resolved, 'register' removed, and a
$VERSION bump.
Diffstat (limited to 'opcode.h')
-rw-r--r-- | opcode.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -398,6 +398,7 @@ EXTCONST char* const PL_op_name[] = { "lock", "once", "custom", + "boolkeys", }; #endif @@ -770,6 +771,7 @@ EXTCONST char* const PL_op_desc[] = { "lock", "once", "unknown custom operator", + "boolkeys", }; #endif @@ -1156,6 +1158,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_lock), MEMBER_TO_FPTR(Perl_pp_once), MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_custom */ + MEMBER_TO_FPTR(Perl_pp_boolkeys), } #endif #ifdef PERL_PPADDR_INITED @@ -1539,6 +1542,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_ck_rfun), /* lock */ MEMBER_TO_FPTR(Perl_ck_null), /* once */ MEMBER_TO_FPTR(Perl_ck_null), /* custom */ + MEMBER_TO_FPTR(Perl_ck_fun), /* boolkeys */ } #endif #ifdef PERL_CHECK_INITED @@ -1916,6 +1920,7 @@ EXTCONST U32 PL_opargs[] = { 0x0000f604, /* lock */ 0x00000600, /* once */ 0x00000000, /* custom */ + 0x00009600, /* boolkeys */ }; #endif |