[svn:parrot] r47810 - trunk/src/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Thu Jun 24 17:06:13 UTC 2010
Author: chromatic
Date: Thu Jun 24 17:06:13 2010
New Revision: 47810
URL: https://trac.parrot.org/parrot/changeset/47810
Log:
[PMC] Sped up Class PMC's isa vtable.
Instead of delegating to isa_pmc, walking the flattened MRO is sufficient for
testing Class identity. This improves the Rakudo startup benchmark by 5% and
should improve all Rakudo programs similarly.
Modified:
trunk/src/pmc/class.pmc
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Thu Jun 24 14:27:52 2010 (r47809)
+++ trunk/src/pmc/class.pmc Thu Jun 24 17:06:13 2010 (r47810)
@@ -1396,8 +1396,22 @@
if (SELF == want_class)
return 1;
+ else {
+ Parrot_Class_attributes * const _class = PARROT_CLASS(SELF);
+
+ INTVAL num_classes = VTABLE_elements(INTERP, _class->all_parents);
+ int i = 0;
+
+ for (i = 1; i < num_classes; ++i) {
+ PMC * const cur_class = VTABLE_get_pmc_keyed_int(INTERP,
+ _class->all_parents, i);
+
+ if (VTABLE_is_same(INTERP, want_class, cur_class))
+ return 1;
+ }
+ }
- return VTABLE_isa_pmc(INTERP, SELF, want_class);
+ return 0;
}
/*
More information about the parrot-commits
mailing list