《CPython Internals》阅读笔记:p356-p359
《CPython Internals》学习第 19天,p356-p359 总结,总计 4 页。
一、技术总结
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。所以作者给的定义非常不准确。
这里补充一个本人认为更准确的定义: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)执行 benchmark
pyperformance compile -U ~/benchmarks/benchmark.cfg HEAD
二、英语总结(生词:0)
无。
关于英语的注解同步更新汇总到 https://github.com/codists/English-In-CS-Books 仓库。
三、其它
阅读这本书的时候,大部分时间都花在了理解“作者说这些表达的是什么意思?”上面了。
四、参考资料
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
欢迎搜索及关注:编程人(a_codists)