summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-09-12 00:19:51 +0000
committerDavid Mitchell <davem@iabyn.com>2009-03-29 18:19:12 +0100
commit0bd07ba73c7a2a849e7fc046ab2530d9522c7bcd (patch)
treefa8b7d3c907c85607d4fbcc83433c6bfaf183381 /proto.h
parent03e4800518c01563fdda5c145899d4f56a95e72d (diff)
downloadperl-0bd07ba73c7a2a849e7fc046ab2530d9522c7bcd.tar.gz
Create a direct lookup hash for ->isa() lookup, by retaining the
de-duping hash used by S_mro_get_linear_isa_dfs(). Provide a new function Perl_get_isa_hash() to lazily retrieve this. (Which could actually be static if S_isa_lookup() and Perl_sv_derived_from() moved into mro.c.) Make S_isa_lookup() use this lookup hash in place of a linear walk of the linear isa. This should turn isa lookups from O(n) to O(1), which should make heavy users of ->isa() faster. (eg PPI, and hence Perl Critic). p4raw-id: //depot/perl@34354 (cherry-picked from commit a49ba3fcbe357fbacf7b9898df08daa2cbdfc8c4)
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 7191d410fb..0530f9d7b0 100644
--- a/proto.h
+++ b/proto.h
@@ -6613,6 +6613,11 @@ PERL_CALLCONV void Perl_sys_init3(int* argc, char*** argv, char*** env)
PERL_CALLCONV void Perl_sys_term(void);
+PERL_CALLCONV HV * Perl_get_isa_hash(pTHX_ HV *const stash)
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_GET_ISA_HASH \
+ assert(stash)
+
END_EXTERN_C
/*