By my profiling, removing the PCCINVOKE call from LexInfo's init_pmc() should
speed up Rakudo's time in "Hello, world!" by about 2.5%. Instead, this patch
slows it down by about 3%. Does that make sense to anyone else?
-- c
diff --git a/src/pmc/lexinfo.pmc b/src/pmc/lexinfo.pmc
index 0f7e5d8..460c183 100644
--- a/src/pmc/lexinfo.pmc
+++ b/src/pmc/lexinfo.pmc
@@ -60,11 +60,15 @@ subroutine.
VTABLE void init_pmc(PMC *sub) {
Parrot_LexInfo_attributes *attrs =
(Parrot_LexInfo_attributes *) PMC_data(SELF);
+ Hash *old_hash = attrs->hash;
PARROT_ASSERT(PObj_constant_TEST(SELF));
+ if (attrs->hash)
+ parrot_hash_destroy(interp, attrs->hash);
- /* Set value type to INTVAL */
- Parrot_PCCINVOKE(interp, SELF, CONST_STRING(INTERP, "set_value_type"), "I->", (INTVAL)enum_type_INTVAL);
+ attrs->hash = parrot_new_hash(interp);
+ attrs->hash->entry_type = enum_type_INTVAL;
+ attrs->hash->container = SELF;
}
/*
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev