《CPython Internals》閱讀筆記:p356-p359
《CPython Internals》學(xué)習(xí)第 19天,p356-p359 總結(jié),總計 4 頁。
一、技術(shù)總結(jié)
1.benchmark suite
The benchmark suite is the tool to use when comparing the complete performance of Python. The Python Benchmark suite is a collection of Python applications designed to test multiple aspects of the Python runtime under load.
如果按照作者所給的定義“The benchmark suite is the tool to use when comparing the complete performance of Python.”,那么 timeit 也算一個 benchmark suite。但是,timeit 不能算作 benchmark suite,可以算一個 benchmark tool。所以作者給的定義非常不準(zhǔn)確。
這里補(bǔ)充一個本人認(rèn)為更準(zhǔn)確的定義:A benchmark suite is a collection of benchmarks(We define a benchmark as a test or set of tests used to compare the performance of alternative tools or techniques.)。
2.pyperformance
pyperformance 是一個 benchmark suite。
(1)安裝
pip install pyperformance
(2)配置
[config]
# Path to output json files
json_dir = ~/benchmarks/json
# If True, compile CPython is debug mode (LTO and PGO disabled),
# run benchmarks with --debug-single-sample, and disable upload.
#
# Use this option used to quickly test a configuration.
debug = False
[scm]
# Directory of CPython source code (Git repository)
repo_dir = ~/cpython
# Update the Git repository (git fetch)?
update = False
# Name of the Git remote, used to create revision of
# the Git branch.
git_remote = remotes/origin
[compile]
# Create files into bench_dir:
bench_dir = ~/benchmarks/tmp
# Link Time Optimization (LTO)?
lto = True
# Profiled Guided Optimization (PGO)?
pgo = True
# The space-separated list of libraries that are package-only
pkg_only =
# Install Python? If false, run Python from the build directory
install = True
[run_benchmark]
# Run "sudo python3 -m pyperf system tune" before running benchmarks?
system_tune = True
# --benchmarks option for 'pyperformance run'
benchmarks =
# --affinity option for 'pyperf system tune' and 'pyperformance run'
affinity =
# Upload generated JSON file?
upload = False
# Configuration to upload results to a Codespeed website
[upload]
url =
environment =
executable =
project =
[compile_all]
# List of CPython Git branches
branches = default 3.6 3.5 2.7
# List of revisions to benchmark by compile_all
[compile_all_revisions]
# list of 'sha1=' (default branch: 'master') or 'sha1=branch'
# used by the "pyperformance compile_all" command
(3)執(zhí)行 benchmark
pyperformance compile -U ~/benchmarks/benchmark.cfg HEAD
二、英語總結(jié)(生詞:0)
無。
關(guān)于英語的注解同步更新匯總到 https://github.com/codists/English-In-CS-Books 倉庫。
三、其它
閱讀這本書的時候,大部分時間都花在了理解“作者說這些表達(dá)的是什么意思?”上面了。
四、參考資料
1. 編程
(1) Anthony Shaw,《CPython Internals》:https://book.douban.com/subject/35405785/
2. 英語
(1) Etymology Dictionary:https://www.etymonline.com
(2) Cambridge Dictionary:https://dictionary.cambridge.org

歡迎搜索及關(guān)注:編程人(a_codists)
浙公網(wǎng)安備 33010602011771號