写点什么

《CPython Internals》阅读笔记:p356-p359

作者:codists
  • 2025-01-25
    广东
  • 本文字数:1434 字

    阅读完需:约 5 分钟

《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 filesjson_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-onlypkg_only =
# Install Python? If false, run Python from the build directoryinstall = 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 branchesbranches = 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)

发布于: 刚刚阅读数: 4
用户头像

codists

关注

公众号:编程人 2021-01-14 加入

Life is short, You need Python

评论

发布
暂无评论
《CPython Internals》阅读笔记:p356-p359_CPython Internals_codists_InfoQ写作社区