[pypy-commit] pypy improve-rbigint: Always inline _normalize. This give a HUGE speedup for lshift, but most calls that does very little work seem to benefit
stian
noreply at buildbot.pypy.org
Sat Jul 21 18:41:38 CEST 2012
Author: stian
Branch: improve-rbigint
Changeset: r56349:9be592831ad5
Date: 2012-07-06 04:49 +0200
http://bitbucket.org/pypy/pypy/changeset/9be592831ad5/
Log: Always inline _normalize. This give a HUGE speedup for lshift, but
most calls that does very little work seem to benefit
diff --git a/pypy/rlib/rbigint.py b/pypy/rlib/rbigint.py
--- a/pypy/rlib/rbigint.py
+++ b/pypy/rlib/rbigint.py
@@ -831,7 +831,7 @@
self._digits = self._digits[:i]
if self.numdigits() == 1 and self.udigit(0) == 0:
self.sign = 0
-
+ _normalize._always_inline_ = True
def bit_length(self):
i = self.numdigits()
if i == 1 and self.digit(0) == 0:
@@ -1392,7 +1392,9 @@
if not size:
size = pin.numdigits()
size -= 1
+
while size >= 0:
+ assert size >= 0
rem = (rem << SHIFT) + pin.widedigit(size)
hi = rem // n
pout.setdigit(size, hi)
diff --git a/pypy/rpython/lltypesystem/rlist.py b/pypy/rpython/lltypesystem/rlist.py
--- a/pypy/rpython/lltypesystem/rlist.py
+++ b/pypy/rpython/lltypesystem/rlist.py
@@ -303,12 +303,12 @@
return l.items
def ll_getitem_fast(l, index):
- ll_assert(index < l.length, "getitem out of bounds")
+ #ll_assert(index < l.length, "getitem out of bounds")
return l.ll_items()[index]
ll_getitem_fast.oopspec = 'list.getitem(l, index)'
def ll_setitem_fast(l, index, item):
- ll_assert(index < l.length, "setitem out of bounds")
+ #ll_assert(index < l.length, "setitem out of bounds")
l.ll_items()[index] = item
ll_setitem_fast.oopspec = 'list.setitem(l, index, item)'
@@ -316,7 +316,7 @@
@typeMethod
def ll_fixed_newlist(LIST, length):
- ll_assert(length >= 0, "negative fixed list length")
+ #ll_assert(length >= 0, "negative fixed list length")
l = malloc(LIST, length)
return l
ll_fixed_newlist.oopspec = 'newlist(length)'
@@ -333,12 +333,12 @@
return l
def ll_fixed_getitem_fast(l, index):
- ll_assert(index < len(l), "fixed getitem out of bounds")
+ #ll_assert(index < len(l), "fixed getitem out of bounds")
return l[index]
ll_fixed_getitem_fast.oopspec = 'list.getitem(l, index)'
def ll_fixed_setitem_fast(l, index, item):
- ll_assert(index < len(l), "fixed setitem out of bounds")
+ #ll_assert(index < len(l), "fixed setitem out of bounds")
l[index] = item
ll_fixed_setitem_fast.oopspec = 'list.setitem(l, index, item)'
More information about the pypy-commit
mailing list