[pypy-commit] pypy faster-rstruct-2: unroll the loop if count is a small constant
antocuni
pypy.commits at gmail.com
Fri May 12 19:25:45 EDT 2017
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91276:f99d6f69a91c
Date: 2017-05-13 00:31 +0200
http://bitbucket.org/pypy/pypy/changeset/f99d6f69a91c/
Log: unroll the loop if count is a small constant
diff --git a/rpython/rlib/mutbuffer.py b/rpython/rlib/mutbuffer.py
--- a/rpython/rlib/mutbuffer.py
+++ b/rpython/rlib/mutbuffer.py
@@ -4,6 +4,7 @@
from rpython.rtyper.annlowlevel import llstr, hlstr
from rpython.rlib.objectmodel import specialize
from rpython.rlib.buffer import Buffer
+from rpython.rlib import jit
class MutableStringBuffer(Buffer):
"""
@@ -46,6 +47,8 @@
def setitem(self, index, char):
self.ll_val.chars[index] = char
+ @jit.look_inside_iff(lambda self, index, count:
+ jit.isconstant(count) and count <= 8)
def setzeros(self, index, count):
for i in range(index, index+count):
self.setitem(i, '\x00')
More information about the pypy-commit
mailing list