First page Back Continue Last page Overview Graphics
Performance
$ python Lib/timeit.py -s "x = 2.0;y = 6.0" "x + y * (y / x) - ((y + x) / y)"
1000000 loops, best of 3: 0.834 usec per loop
$
$ python Lib/timeit.py -s "import decimal;x = decimal.Decimal('2.0');y = decimal.Decimal('6.0')" "x + y * (y / x) - ((y + x) / y)"
1000 loops, best of 3: 738 usec per loop
-
About 1000 times slower!! – hardware speed vs Python speed.
C speed is a middle ground.
Notes: