bpo-32630 benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ envs/3.7-master-pgo-lto/prefix/bin/python3.7m ~/dev/python/cpython/Modules/_decimal/tests/bench.py | |
# ====================================================================== | |
# Calculating pi, 10000 iterations | |
# ====================================================================== | |
Precision: 9 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.048688s | |
cdecimal: | |
result: 3.14159265 | |
time: 0.096675s | |
decimal: | |
result: 3.14159265 | |
time: 8.458241s | |
Precision: 19 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.051486s | |
cdecimal: | |
result: 3.141592653589793236 | |
time: 0.226973s | |
decimal: | |
result: 3.141592653589793236 | |
time: 19.495910s | |
# ====================================================================== | |
# Factorial | |
# ====================================================================== | |
n = 100000 | |
cdecimal: | |
calculation time: 0.356986s | |
conversion time: 0.001510s | |
int: | |
calculation time: 0.232633s | |
conversion time: 3.223236s | |
------------------------------------------------------------------------------------------------------------------------ | |
$ envs/3.7-master-pgo+lto+decimal-contextvars/prefix/bin/python3.7m ~/dev/python/cpython/Modules/_decimal/tests/bench.py | |
# ====================================================================== | |
# Calculating pi, 10000 iterations | |
# ====================================================================== | |
Precision: 9 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.048424s | |
cdecimal: | |
result: 3.14159265 | |
time: 0.100751s | |
decimal: | |
result: 3.14159265 | |
time: 8.441837s | |
Precision: 19 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.049039s | |
cdecimal: | |
result: 3.141592653589793236 | |
time: 0.227153s | |
decimal: | |
result: 3.141592653589793236 | |
time: 19.353406s | |
# ====================================================================== | |
# Factorial | |
# ====================================================================== | |
n = 100000 | |
cdecimal: | |
calculation time: 0.349761s | |
conversion time: 0.001494s | |
int: | |
calculation time: 0.236077s | |
conversion time: 3.224016s |
Author
elprans
commented
Jan 26, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment