Created
November 16, 2019 08:09
-
-
Save pomidoroshev/a3945701a5d7743e5ea705067aba554f to your computer and use it in GitHub Desktop.
String concatenation 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
▶ for ver in "3.7.1" "3.7.2" "3.7.3" "3.7.4" "3.7.5" "3.8" | |
do | |
echo "\nPython $ver" | |
docker run --rm -v `pwd`:/app python:$ver python /app/bench.py | |
done | |
Python 3.7.1 | |
# components | join_time (μs) | buffer_time (μs) | concat_time (μs) | |
----------------------------------------------------------------------------------------- | |
10 | 2.80 (± 0.10) | 3.3 (± 0.1) | 2.45 (± 0.07) | |
100 | 22 (± 1) | 22.9 (± 0.8) | 20.2 (± 0.5) | |
1000 | 209 (± 6) | 221 (± 5) | 220 (± 10) | |
10000 | 2160 (± 60) | 2220 (± 80) | 2260 (± 80) | |
Python 3.7.2 | |
# components | join_time (μs) | buffer_time (μs) | concat_time (μs) | |
----------------------------------------------------------------------------------------- | |
10 | 2.80 (± 0.07) | 3.33 (± 0.06) | 2.44 (± 0.04) | |
100 | 21.0 (± 0.6) | 23.1 (± 1.0) | 20.7 (± 0.6) | |
1000 | 207 (± 5) | 217 (± 6) | 222 (± 5) | |
10000 | 2090 (± 50) | 2300 (± 100) | 2440 (± 100) | |
Python 3.7.3 | |
# components | join_time (μs) | buffer_time (μs) | concat_time (μs) | |
----------------------------------------------------------------------------------------- | |
10 | 2.8 (± 0.2) | 3.34 (± 0.08) | 2.40 (± 0.07) | |
100 | 21.5 (± 0.8) | 23.2 (± 0.7) | 20.4 (± 0.4) | |
1000 | 209 (± 4) | 250 (± 50) | 219 (± 6) | |
10000 | 2130 (± 60) | 2240 (± 90) | 2240 (± 40) | |
Python 3.7.4 | |
# components | join_time (μs) | buffer_time (μs) | concat_time (μs) | |
----------------------------------------------------------------------------------------- | |
10 | 2.32 (± 0.05) | 3.0 (± 0.2) | 2.1 (± 0.1) | |
100 | 17.9 (± 0.4) | 21 (± 2) | 16.8 (± 0.8) | |
1000 | 176 (± 4) | 190 (± 4) | 173 (± 4) | |
10000 | 1900 (± 200) | 2000 (± 100) | 1800 (± 90) | |
Python 3.7.5 | |
# components | join_time (μs) | buffer_time (μs) | concat_time (μs) | |
----------------------------------------------------------------------------------------- | |
10 | 2.34 (± 0.05) | 2.9 (± 0.1) | 2.01 (± 0.07) | |
100 | 18.1 (± 0.5) | 19.6 (± 0.7) | 17 (± 1) | |
1000 | 174 (± 5) | 183 (± 4) | 175 (± 5) | |
10000 | 1800 (± 70) | 1900 (± 100) | 1740 (± 40) | |
Python 3.8 | |
# components | join_time (μs) | buffer_time (μs) | concat_time (μs) | |
----------------------------------------------------------------------------------------- | |
10 | 2.56 (± 0.03) | 3.2 (± 0.1) | 3.0 (± 0.8) | |
100 | 18.4 (± 0.4) | 19.9 (± 0.8) | 19.5 (± 0.3) | |
1000 | 186 (± 7) | 192 (± 7) | 210 (± 10) | |
10000 | 1870 (± 50) | 2000 (± 100) | 2080 (± 40) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment