[pypy-commit] pypy improve-rbigint: Remove the special casing in _x_add, it's really the same (only that by doing this, we also got to do two extra checks, which makes it slower)
stian
noreply at buildbot.pypy.org
Sat Jul 21 18:41:05 CEST 2012
Author: stian
Branch: improve-rbigint
Changeset: r56319:e23369402d82
Date: 2012-06-23 00:41 +0200
http://bitbucket.org/pypy/pypy/changeset/e23369402d82/
Log: Remove the special casing in _x_add, it's really the same (only that
by doing this, we also got to do two extra checks, which makes it
slower)
diff --git a/pypy/rlib/rbigint.py b/pypy/rlib/rbigint.py
--- a/pypy/rlib/rbigint.py
+++ b/pypy/rlib/rbigint.py
@@ -763,20 +763,13 @@
""" Add the absolute values of two bigint integers. """
size_a = a.numdigits()
-
- # Special casing. This is good, sometimes.
- # The sweetspot is hard to find. But it's someplace between 60 and 70.
- if size_a < 65 and a is b:
- return a.lqshift(1)
-
-
size_b = b.numdigits()
# Ensure a is the larger of the two:
if size_a < size_b:
a, b = b, a
size_a, size_b = size_b, size_a
- z = rbigint([NULLDIGIT] * (a.numdigits() + 1), 1)
+ z = rbigint([NULLDIGIT] * (size_a + 1), 1)
i = 0
carry = r_uint(0)
while i < size_b:
diff --git a/pypy/translator/goal/targetbigintbenchmark.py b/pypy/translator/goal/targetbigintbenchmark.py
--- a/pypy/translator/goal/targetbigintbenchmark.py
+++ b/pypy/translator/goal/targetbigintbenchmark.py
@@ -10,7 +10,8 @@
"""
A cutout with some benchmarks.
Pypy default:
- <No run yet>
+ 8.637287
+ 12.211942
18.270045
2.512140
14.148920
@@ -24,7 +25,7 @@
1.635417
12.023154
14.320596
- 6.464143
+ 6.439088
"""
More information about the pypy-commit
mailing list