Author: Antonio Cuni <[email protected]>
Branch: fastjson
Changeset: r64830:e851f2e812ec
Date: 2013-06-06 16:53 +0200
http://bitbucket.org/pypy/pypy/changeset/e851f2e812ec/

Log:    call math.pow only when it's really needed. Believe it or not, it
        saves another 5% on my benchmark

diff --git a/pypy/module/_fastjson/interp_decoder.py 
b/pypy/module/_fastjson/interp_decoder.py
--- a/pypy/module/_fastjson/interp_decoder.py
+++ b/pypy/module/_fastjson/interp_decoder.py
@@ -160,7 +160,8 @@
         if is_float:
             # build the float
             floatval = intval + frcval
-            floatval = floatval * math.pow(10, exp)
+            if exp != 0:
+                floatval = floatval * math.pow(10, exp)
             return self.space.wrap(floatval)
         else:
             return self.space.wrap(intval)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to