[svn:parrot] r38567 - trunk/src/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Fri May 8 00:56:50 UTC 2009
Author: chromatic
Date: Fri May 8 00:56:49 2009
New Revision: 38567
URL: https://trac.parrot.org/parrot/changeset/38567
Log:
[PMC] Added delete_keyed_int VTABLE entry and rewrote delete_keyed entry for
ResizblePMCArray. This avoids unnecessary manual boxing of an INTVAL key into
an Integer PMC which immediately gets unboxed back into an INTVAL. This
improves Rakudo startup by a minor but measurable 1.34%.
Modified:
trunk/src/pmc/resizablepmcarray.pmc
Modified: trunk/src/pmc/resizablepmcarray.pmc
==============================================================================
--- trunk/src/pmc/resizablepmcarray.pmc Fri May 8 00:54:52 2009 (r38566)
+++ trunk/src/pmc/resizablepmcarray.pmc Fri May 8 00:56:49 2009 (r38567)
@@ -278,14 +278,17 @@
}
VTABLE void delete_keyed(PMC *key) {
- INTVAL i;
- INTVAL idx = key_integer(INTERP, key);
- INTVAL n = PMC_size(SELF);
+ const INTVAL idx = key_integer(INTERP, key);
+ SELF.delete_keyed_int(idx);
+ }
+
+ VTABLE void delete_keyed_int(INTVAL idx) {
PMC **data = PMC_array(SELF);
+ INTVAL n = PMC_size(SELF);
+ INTVAL i;
- for (i = idx; i < n - 1; ++i) {
+ for (i = idx; i < n - 1; ++i)
data[i] = data[i + 1];
- }
PMC_size(SELF)--;
}
More information about the parrot-commits
mailing list