diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-11-16 10:00:50 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-11-17 10:13:43 -0800 |
commit | 8c34e50dccefe2a0539ba2339a2889bb841986c2 (patch) | |
tree | c70c4467270f2e76d3e10faa1fdca9b902e109fa /perl.h | |
parent | c342cf44e9b6e2978a5bf7f3037755edf7df5fac (diff) | |
download | perl-8c34e50dccefe2a0539ba2339a2889bb841986c2.tar.gz |
[perl #114864] Don’t use amt for DESTROY
DESTROY has been cached in overload tables since
perl-5.6.0-2080-g32251b2, making it 4 times faster than before (over-
load tables are faster than method lookup).
But it slows down symbol lookup on stashes with overload tables,
because overload tables use magic, and SvRMAGICAL results in calls to
mg_find on every hash lookup.
By reusing SvSTASH(stash) to cache the DESTROY method (if the stash
is unblessed, of course, as most stashes are), we can avoid making
all destroyable stashes magical and also speed up DESTROY lookup
slightly more.
The results:
• 10% increase in stash lookup speed after destructors. That was just
testing $Foo::{x}. Other stash lookups will have other overheads
that make the difference less impressive.
• 5% increase in DESTROY lookup speed. I was using an empty DESTROY
method to test this, so, again, real DESTROY methods will have more
overhead and less speedup.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 4 |
1 files changed, 0 insertions, 4 deletions
@@ -5240,13 +5240,9 @@ typedef struct am_table_short AMTS; #define AMGfallYES 3 #define AMTf_AMAGIC 1 -#define AMTf_OVERLOADED 2 #define AMT_AMAGIC(amt) ((amt)->flags & AMTf_AMAGIC) #define AMT_AMAGIC_on(amt) ((amt)->flags |= AMTf_AMAGIC) #define AMT_AMAGIC_off(amt) ((amt)->flags &= ~AMTf_AMAGIC) -#define AMT_OVERLOADED(amt) ((amt)->flags & AMTf_OVERLOADED) -#define AMT_OVERLOADED_on(amt) ((amt)->flags |= AMTf_OVERLOADED) -#define AMT_OVERLOADED_off(amt) ((amt)->flags &= ~AMTf_OVERLOADED) #define StashHANDLER(stash,meth) gv_handler((stash),CAT2(meth,_amg)) |