Author: Alex Gaynor <alex.gay...@gmail.com>
Branch: unroll-if-alt
Changeset: r46118:f6a4c8d01004
Date: 2011-07-30 20:43 -0700
http://bitbucket.org/pypy/pypy/changeset/f6a4c8d01004/

Log:    Unroll this function so that "const str" % mapping is fast.

diff --git a/pypy/objspace/std/formatting.py b/pypy/objspace/std/formatting.py
--- a/pypy/objspace/std/formatting.py
+++ b/pypy/objspace/std/formatting.py
@@ -175,6 +175,9 @@
                 raise OperationError(space.w_ValueError,
                                      space.wrap("incomplete format"))
 
+        # Only shows up if we've already started inlining format(), so just
+        # unconditionally unroll this.
+        @jit.unroll_safe
         def getmappingkey(self):
             # return the mapping key in a '%(key)s' specifier
             fmt = self.fmt
@@ -235,8 +238,7 @@
 
             return w_value
 
-        # Only shows up if we've already started inlining format(), so just
-        # unconditionally unroll this.
+        # Same as getmappingkey
         @jit.unroll_safe
         def peel_flags(self):
             self.f_ljust = False
@@ -260,7 +262,7 @@
                     break
                 self.forward()
 
-        # Same as peel_flags.
+        # Same as getmappingkey
         @jit.unroll_safe
         def peel_num(self):
             space = self.space
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to