[pypy-commit] pypy unroll-if-alt: Special case for length == 1 here, helps the non-jit case as well.

alex_gaynor noreply at buildbot.pypy.org
Sat Jul 30 08:20:03 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: unroll-if-alt
Changeset: r46101:e18517492237
Date: 2011-07-29 23:20 -0700
http://bitbucket.org/pypy/pypy/changeset/e18517492237/

Log:	Special case for length == 1 here, helps the non-jit case as well.

diff --git a/pypy/rpython/lltypesystem/rstr.py b/pypy/rpython/lltypesystem/rstr.py
--- a/pypy/rpython/lltypesystem/rstr.py
+++ b/pypy/rpython/lltypesystem/rstr.py
@@ -686,6 +686,10 @@
     @jit.unroll_if(lambda length, items: jit.isconstant(length) and length <= 2)
     @enforceargs(int, None)
     def ll_join_strs(length, items):
+        # Special case for length 1 items, helps both the JIT and other code
+        if length == 1:
+            return items[0]
+
         num_items = length
         itemslen = 0
         i = 0


More information about the pypy-commit mailing list