Edited at

Python 3.7のベンチマーク

More than 1 year has passed since last update.

Python 3.7がリリースされていたので、Benchmarkerのサンプルコードで簡単にベンチマークした結果です。


ベンチマーク結果


3.6

$ python3 example.py -o result3_6.json

## benchmarker: release 4.0.1 (for python)
## python version: 3.6.5
## python compiler: GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)
## python platform: Darwin-16.7.0-x86_64-i386-64bit
## python executable: /usr/local/opt/python/bin/python3.6
## cpu model: Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
## parameters: loop=1000000, cycle=1, extra=0

## real (total = user + sys)
(Empty) 0.0277 0.0300 0.0300 0.0000
join 0.2340 0.2300 0.2300 0.0000
concat 0.2714 0.2700 0.2700 0.0000
format 0.3307 0.3200 0.3200 0.0000

## Ranking real
join 0.2340 (100.0) ********************
concat 0.2714 ( 86.2) *****************
format 0.3307 ( 70.8) **************

## Matrix real [01] [02] [03]
[01] join 0.2340 100.0 116.0 141.3
[02] concat 0.2714 86.2 100.0 121.9
[03] format 0.3307 70.8 82.0 100.0


3.7

$ python3 example.py -o result3_7.json

## benchmarker: release 4.0.1 (for python)
## python version: 3.7.0
## python compiler: Clang 9.0.0 (clang-900.0.39.2)
## python platform: Darwin-16.7.0-x86_64-i386-64bit
## python executable: /usr/local/opt/python/bin/python3.7
## cpu model: Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
## parameters: loop=1000000, cycle=1, extra=0

## real (total = user + sys)
(Empty) 0.0258 0.0200 0.0200 0.0000
join 0.2265 0.2400 0.2300 0.0100
concat 0.3118 0.3200 0.3200 0.0000
format 0.3388 0.3400 0.3400 0.0000

## Ranking real
join 0.2265 (100.0) ********************
concat 0.3118 ( 72.7) ***************
format 0.3388 ( 66.9) *************

## Matrix real [01] [02] [03]
[01] join 0.2265 100.0 137.6 149.6
[02] concat 0.3118 72.7 100.0 108.7
[03] format 0.3388 66.9 92.0 100.0


所感

文字列結合がそこそこ遅くなっているのが目立つ。