[pypy-commit] pypy improve-rbigint: Fix a tiny issue when SUPPORT_INT = False, also add benchmark results

stian noreply at buildbot.pypy.org
Sat Jul 21 18:42:00 CEST 2012


Author: stian
Branch: improve-rbigint
Changeset: r56368:e372c50f3914
Date: 2012-07-14 02:41 +0200
http://bitbucket.org/pypy/pypy/changeset/e372c50f3914/

Log:	Fix a tiny issue when SUPPORT_INT = False, also add benchmark
	results

diff --git a/pypy/rlib/rbigint.py b/pypy/rlib/rbigint.py
--- a/pypy/rlib/rbigint.py
+++ b/pypy/rlib/rbigint.py
@@ -90,19 +90,10 @@
     else:
         return r_longlong(x)
 _widen_digit._always_inline_ = True
+
 def _store_digit(x):
-    """if not we_are_translated():
-        assert is_valid_int(x), "store_digit() takes an int, got a %r" % type(x)"""
-    if SHIFT <= 15:
-        return rffi.cast(rffi.SHORT, x)
-    elif SHIFT <= 31:
-        return rffi.cast(rffi.INT, x)
-    elif SHIFT <= 63:
-        return rffi.cast(STORE_TYPE, x)
-    else:
-        raise ValueError("SHIFT too large!")
+    return rffi.cast(STORE_TYPE, x)
 _store_digit._annspecialcase_ = 'specialize:argtype(0)'
-_store_digit._always_inline_ = True
 
 def _load_unsigned_digit(x):
     return rffi.cast(UNSIGNED_TYPE, x)
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
@@ -54,22 +54,27 @@
         v = v + v 2.820538
         Sum:  41.234060
 
-        A pure python form of those tests where also run
-        Improved pypy           | Pypy                  | CPython 2.7.3
-        0.000210046768188        2.82172012329             1.38699007034
-        0.123202085495           0.126130104065            8.17586708069
-        0.123197078705           0.124358177185            8.34655714035
-        0.0616521835327          0.0626962184906           4.88309693336
-        0.0617570877075          0.0626759529114           4.88519001007
-        0.000902891159058        479.282402992             (forever, I yet it run for 5min before quiting)
-        1.65824794769            (forever)                 (another forever)
-        0.000197887420654        6.59566307068             8.29050803185
-        5.32597303391            12.1487128735             7.1309800148
-        6.45182704926            15.0498359203             11.733394146
-        0.000119924545288        2.13657021523             1.67227101326
-        3.96346402168            14.7546520233             9.05311799049
-        8.30484199524            17.0125601292             11.1488289833
-        4.99971699715            6.59027791023             3.63601899147
+
+        With SUPPORT_INT128 set to False
+        mod by 2:  0.004103
+        mod by 10000:  3.237434
+        mod by 1024 (power of two):  0.016363
+        Div huge number by 2**128: 2.836237
+        rshift: 2.343860
+        lshift: 1.172665
+        Floordiv by 2: 1.537474
+        Floordiv by 3 (not power of two): 3.796015
+        2**500000: 0.327269
+        (2**N)**5000000 (power of two): 0.084709
+        10000 ** BIGNUM % 100 2.063215
+        i = i * i: 8.109634
+        n**10000 (not power of two): 11.243292
+        Power of two ** power of two: 0.072559
+        v = v * power of two 9.753532
+        v = v * v 13.569841
+        v = v + v 5.760466
+        Sum:  65.928667
+
     """
     sumTime = 0.0
     


More information about the pypy-commit mailing list