
是用于测试python性能的一个软件套装。
作用是对python不同的版本测试性能,发现Python在实现过程中是否有性能衰减,当然也可以用于测试不同的机器的性能差异。
Usage — Python Performance Benchmark Suite 1.0.3 documentation
大家注意,大多数情况下,我们只需要看官方文档就可以了。因为其他人写的文档肯定没有官方写的好,写的具体,写的全面。
我这里只是把大体的情况罗列一下,具体的还是要看官方文档。
python3 -m pip install pyperformance运行:
pyperformance run --python=python3.6 -o py36.json pyperformance run --python=python3.7 -o py38.json pyperformance compare py36.json py38.json
python3 -m pyperformance run -o py38.json
对结果进行检查:python3 -m pyperf show py36.json python3 -m pyperf check py36.json python3 -m pyperf metadata py36.json python3 -m pyperf stats py36.json python3 -m pyperf hist py36.json python3 -m pyperf dump py36.json性能对比:
python3 -m pyperf compare_to py36.json py38.json --table
以表格的形式输出的样子:
+-------------------------+----------+------------------------+ | Benchmark | u540 | u740 | +=========================+==========+========================+ | 2to3 | 8.76 sec | 7.36 sec: 1.19x faster | +-------------------------+----------+------------------------+ | chameleon | 369 ms | 280 ms: 1.32x faster | +-------------------------+----------+------------------------+ | chaos | 3.18 sec | 2.72 sec: 1.17x faster | +-------------------------+----------+------------------------+ | crypto_pyaes | 2.85 sec | 2.47 sec: 1.15x faster | +-------------------------+----------+------------------------+ | deltablue | 222 ms | 186 ms: 1.19x faster | +-------------------------+----------+------------------------+ | django_template | 1.86 sec | 1.62 sec: 1.15x faster | +-------------------------+----------+------------------------+ | dulwich_log | 1.63 sec | 1.48 sec: 1.10x faster | +-------------------------+----------+------------------------+ | fannkuch | 10.0 sec | 9.46 sec: 1.06x faster | +-------------------------+----------+------------------------+ | float | 3.82 sec | 2.81 sec: 1.36x faster | +-------------------------+----------+------------------------+ | go | 7.28 sec | 6.18 sec: 1.18x faster | +-------------------------+----------+------------------------+ | hexiom | 302 ms | 230 ms: 1.31x faster | +-------------------------+----------+------------------------+ | json_dumps | 397 ms | 335 ms: 1.18x faster | +-------------------------+----------+------------------------+ | json_loads | 581 us | 594 us: 1.02x slower | +-------------------------+----------+------------------------+ | logging_format | 343 us | 263 us: 1.30x faster | +-------------------------+----------+------------------------+ | logging_silent | 6.65 us | 4.78 us: 1.39x faster | +-------------------------+----------+------------------------+ | logging_simple | 282 us | 243 us: 1.16x faster | +-------------------------+----------+------------------------+ | mako | 581 ms | 450 ms: 1.29x faster | +-------------------------+----------+------------------------+ | meteor_contest | 2.15 sec | 1.85 sec: 1.16x faster | +-------------------------+----------+------------------------+ | nbody | 2.96 sec | 2.59 sec: 1.14x faster | +-------------------------+----------+------------------------+ | nqueens | 2.73 sec | 2.39 sec: 1.14x faster | +-------------------------+----------+------------------------+ | pathlib | 591 ms | 517 ms: 1.14x faster | +-------------------------+----------+------------------------+ | pickle | 200 us | 217 us: 1.09x slower | +-------------------------+----------+------------------------+ | pickle_dict | 400 us | 483 us: 1.21x slower | +-------------------------+----------+------------------------+ | pickle_list | 59.0 us | 65.6 us: 1.11x slower | +-------------------------+----------+------------------------+ | pickle_pure_python | 17.3 ms | 12.9 ms: 1.35x faster | +-------------------------+----------+------------------------+ | pidigits | 2.36 sec | 3.53 sec: 1.50x slower | +-------------------------+----------+------------------------+ | pyflate | 19.9 sec | 16.6 sec: 1.20x faster | +-------------------------+----------+------------------------+ | python_startup | 133 ms | 121 ms: 1.10x faster | +-------------------------+----------+------------------------+ | python_startup_no_site | 86.7 ms | 79.0 ms: 1.10x faster | +-------------------------+----------+------------------------+ | raytrace | 15.1 sec | 13.0 sec: 1.17x faster | +-------------------------+----------+------------------------+ | regex_compile | 4.90 sec | 3.97 sec: 1.23x faster | +-------------------------+----------+------------------------+ | regex_dna | 2.69 sec | 3.15 sec: 1.17x slower | +-------------------------+----------+------------------------+ | regex_effbot | 55.6 ms | 62.7 ms: 1.13x slower | +-------------------------+----------+------------------------+ | regex_v8 | 432 ms | 449 ms: 1.04x slower | +-------------------------+----------+------------------------+ | richards | 2.10 sec | 1.80 sec: 1.17x faster | +-------------------------+----------+------------------------+ | scimark_fft | 8.18 sec | 7.24 sec: 1.13x faster | +-------------------------+----------+------------------------+ | scimark_lu | 4.96 sec | 3.98 sec: 1.25x faster | +-------------------------+----------+------------------------+ | scimark_monte_carlo | 2.94 sec | 2.52 sec: 1.17x faster | +-------------------------+----------+------------------------+ | scimark_sor | 5.39 sec | 4.72 sec: 1.14x faster | +-------------------------+----------+------------------------+ | scimark_sparse_mat_mult | 144 ms | 101 ms: 1.42x faster | +-------------------------+----------+------------------------+ | spectral_norm | 3.57 sec | 3.18 sec: 1.12x faster | +-------------------------+----------+------------------------+ | sqlalchemy_declarative | 3.08 sec | 2.66 sec: 1.16x faster | +-------------------------+----------+------------------------+ | sqlalchemy_imperative | 425 ms | 366 ms: 1.16x faster | +-------------------------+----------+------------------------+ | sqlite_synth | 85.8 us | 77.2 us: 1.11x faster | +-------------------------+----------+------------------------+ | sympy_expand | 14.5 sec | 12.2 sec: 1.18x faster | +-------------------------+----------+------------------------+ | sympy_integrate | 541 ms | 459 ms: 1.18x faster | +-------------------------+----------+------------------------+ | sympy_sum | 4.07 sec | 3.55 sec: 1.15x faster | +-------------------------+----------+------------------------+ | sympy_str | 8.45 sec | 7.08 sec: 1.19x faster | +-------------------------+----------+------------------------+ | telco | 221 ms | 189 ms: 1.17x faster | +-------------------------+----------+------------------------+ | unpack_sequence | 1.17 us | 1.05 us: 1.12x faster | +-------------------------+----------+------------------------+ | unpickle | 308 us | 329 us: 1.07x slower | +-------------------------+----------+------------------------+ | unpickle_list | 76.8 us | 74.9 us: 1.03x faster | +-------------------------+----------+------------------------+ | unpickle_pure_python | 11.4 ms | 9.11 ms: 1.25x faster | +-------------------------+----------+------------------------+ | xml_etree_parse | 3.79 sec | 3.41 sec: 1.11x faster | +-------------------------+----------+------------------------+ | xml_etree_iterparse | 3.04 sec | 2.48 sec: 1.23x faster | +-------------------------+----------+------------------------+ | xml_etree_generate | 3.12 sec | 2.58 sec: 1.21x faster | +-------------------------+----------+------------------------+ | xml_etree_process | 2.58 sec | 2.15 sec: 1.20x faster | +-------------------------+----------+------------------------+ | Geometric mean | (ref) | 1.13x faster | +-------------------------+----------+------------------------+
参考:
Python性能测试之performance | 天问博客
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)