> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/life/di-si-bu-fen-unix-zhi-wai/10.-unix-fu-wu/10.1.-ji-zhun-ce-shi.md).

# 10.1 基准测试

> “有谎言，有该死的谎言，然后还有基准测试。”—— 佚名

人们用基准测试来评判不同程序（或机器、操作系统等）的优劣，依据是完成同一件工作所需时间的长短（或者空间、价格等）。基准测试常常沦为笑柄，因为它们往往被拿来当作无效外推的根据，得出的结论离谱至极、误导性十足。不过，明智地使用基准测试也是可能的，比如用它来做系统调优。

据说有些系统认得出自己正在运行基准测试，于是直接打印出一个预先算好的答案。这种事虽然让人难以置信，但优秀的优化器的本事，已经足以删掉大多数基准测试中通常占相当比重的死代码，从而让基准测试设计者的意图落空。无论如何，对基准测试都要保持高度警惕。要检验系统的吞吐量，现实得多的做法是坐到系统跟前，试着运行几个你自己的应用程序。别忘了确认它的内存容量与你中意的那台系统相当，速度、磁盘和网络也与之相同。（典型的展厅样机都插满了内存，配着高速磁盘。）

你若是执意无视我们的警告，卖基准测试的公司有的是。其中比较知名的有：Aim Technology、Neal Nelson & Associates 和 Performance Awareness。不言而喻，对 UNIX 厂商自己拿出的基准测试，你尤其要多加提防。

关于 UNIX 基准测试，有几篇不错的读物：“The Evolution of UNIX System Performance”，作者 J. Feder，载于 AT\&T Bell Laboratories Technical Journal 第 63 卷第 8 期，1984 年 10 月；“Benchmark Confessions”，作者 P. Marvit 和 M. Nair，载于 The UNIX System – Encyclopaedia，Yates Ventures，1984 年；以及“Benchmarking UNIX Systems”，作者 D. Hinnant，载于 BYTE Magazine 第 9 卷第 8 期，1984 年 8 月。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://book.bsdcn.org/life/di-si-bu-fen-unix-zhi-wai/10.-unix-fu-wu/10.1.-ji-zhun-ce-shi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
