summaryrefslogtreecommitdiff
path: root/overload.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-11-16 10:00:50 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-11-17 10:13:43 -0800
commit8c34e50dccefe2a0539ba2339a2889bb841986c2 (patch)
treec70c4467270f2e76d3e10faa1fdca9b902e109fa /overload.h
parentc342cf44e9b6e2978a5bf7f3037755edf7df5fac (diff)
downloadperl-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 'overload.h')
-rw-r--r--overload.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/overload.h b/overload.h
index 24cde2ad13..1628ac0025 100644
--- a/overload.h
+++ b/overload.h
@@ -82,7 +82,6 @@ enum {
smart_amg, /* 0x41 ~~ */
ftest_amg, /* 0x42 -X */
regexp_amg, /* 0x43 qr */
- DESTROY_amg, /* 0x44 DESTROY */
max_amg_code
/* Do not leave a trailing comma here. C9X allows it, C89 doesn't. */
};