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 /proto.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 'proto.h')
-rw-r--r-- | proto.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1400,6 +1400,13 @@ PERL_CALLCONV I32 Perl_keyword(pTHX_ const char *name, I32 len, bool all_keyword #define PERL_ARGS_ASSERT_KEYWORD \ assert(name) +#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT) +STATIC OP* S_opt_scalarhv(pTHX_ OP* rep_op) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_OPT_SCALARHV \ + assert(rep_op) + +#endif PERL_CALLCONV void Perl_leave_scope(pTHX_ I32 base); PERL_CALLCONV void Perl_lex_end(pTHX); PERL_CALLCONV void Perl_lex_start(pTHX_ SV* line, PerlIO *rsfp, bool new_filter); |