[svn:parrot] r48293 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Aug 3 18:57:49 UTC 2010


Author: chromatic
Date: Tue Aug  3 18:57:49 2010
New Revision: 48293
URL: https://trac.parrot.org/parrot/changeset/48293

Log:
[PMC] Optimized ImageIO PMC's shift_integer.

Inlining what PF_fetch_integer() does avoids double dispatch and improves
Rakudo startup by 3.122%.

Modified:
   trunk/src/pmc/imageio.pmc

Modified: trunk/src/pmc/imageio.pmc
==============================================================================
--- trunk/src/pmc/imageio.pmc	Tue Aug  3 18:22:25 2010	(r48292)
+++ trunk/src/pmc/imageio.pmc	Tue Aug  3 18:57:49 2010	(r48293)
@@ -602,11 +602,13 @@
 */
 
     VTABLE INTVAL shift_integer() {
-        const opcode_t *pos = GET_VISIT_CURSOR(SELF);
-        /* something is likely wrong if the packfile is NULL */
-        const INTVAL    i   = PF_fetch_integer(PARROT_IMAGEIO(SELF)->pf,
-                                (const opcode_t **)&pos);
-        SET_VISIT_CURSOR(SELF, (char *)pos);
+        /* inlining PF_fetch_integer speeds up PBC thawing measurably */
+        const PackFile      *pf     = PARROT_IMAGEIO(SELF)->pf;
+        const opcode_t      *pos    = GET_VISIT_CURSOR(SELF);
+        const unsigned char *stream = (const unsigned char *)pos;
+        const INTVAL         i      = pf->fetch_iv(stream);
+
+        SET_VISIT_CURSOR(SELF, (const char *)pos + pf->header->wordsize);
         BYTECODE_SHIFT_OK(SELF);
         return i;
     }


More information about the parrot-commits mailing list