{"id":13618363,"url":"https://github.com/chinanf-boy/hyperfine-zh","last_synced_at":"2025-03-20T14:30:42.662Z","repository":{"id":39167063,"uuid":"146868610","full_name":"chinanf-boy/hyperfine-zh","owner":"chinanf-boy","description":"🇨🇳翻译: \u003chyperfine\u003e 命令行基准测试工具 ❤️ 校对 ✅","archived":false,"fork":false,"pushed_at":"2019-03-29T04:47:57.000Z","size":9,"stargazers_count":85,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T17:05:16.590Z","etag":null,"topics":["bench","docs","rust","zh"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinanf-boy.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-31T09:08:11.000Z","updated_at":"2025-01-15T08:23:15.000Z","dependencies_parsed_at":"2022-08-18T14:11:26.872Z","dependency_job_id":null,"html_url":"https://github.com/chinanf-boy/hyperfine-zh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fhyperfine-zh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fhyperfine-zh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fhyperfine-zh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fhyperfine-zh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinanf-boy","download_url":"https://codeload.github.com/chinanf-boy/hyperfine-zh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244630013,"owners_count":20484298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bench","docs","rust","zh"],"created_at":"2024-08-01T20:01:59.563Z","updated_at":"2025-03-20T14:30:42.372Z","avatar_url":"https://github.com/chinanf-boy.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# hyperfine [![translate-svg]][translate-list]\n\n[translate-svg]: http://llever.com/translate.svg\n[translate-list]: https://github.com/chinanf-boy/chinese-translate-list\n    \n「 命令行基准测试工具 」\n\n[中文](./readme.md) | [english](https://github.com/sharkdp/hyperfine)\n\n\n---\n\n## 校对 ✅\n\n\u003c!-- doc-templite START generated --\u003e\n\u003c!-- repo = 'sharkdp/hyperfine' --\u003e\n\u003c!-- commit = '094b76d23a74341de2e03e34eb15285895517b2b' --\u003e\n\u003c!-- time = '2018 9.28' --\u003e\n翻译的原文 | 与日期 | 最新更新 | 更多\n---|---|---|---\n[commit] | ⏰ 2018 9.28 | ![last] | [中文翻译][translate-list]\n\n[last]: https://img.shields.io/github/last-commit/sharkdp/hyperfine.svg\n[commit]: https://github.com/sharkdp/hyperfine/tree/094b76d23a74341de2e03e34eb15285895517b2b\n\n\u003c!-- doc-templite END generated --\u003e\n\n\n### 贡献\n\n欢迎 👏 勘误/校对/更新贡献 😊 [具体贡献请看](https://github.com/chinanf-boy/chinese-translate-list#贡献)\n\n## 生活\n\n[If help, **buy** me coffee —— 营养跟不上了，给我来瓶营养快线吧! 💰](https://github.com/chinanf-boy/live-need-money)\n\n---\n\n### 目录\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [hyperfine](#hyperfine)\n  - [特征](#%E7%89%B9%E5%BE%81)\n  - [用法](#%E7%94%A8%E6%B3%95)\n    - [基本基准测试](#%E5%9F%BA%E6%9C%AC%E5%9F%BA%E5%87%86%E6%B5%8B%E8%AF%95)\n    - [注重 I/O 的程序](#%E6%B3%A8%E9%87%8D-io-%E7%9A%84%E7%A8%8B%E5%BA%8F)\n    - [参数化基准](#%E5%8F%82%E6%95%B0%E5%8C%96%E5%9F%BA%E5%87%86)\n    - [导出结果](#%E5%AF%BC%E5%87%BA%E7%BB%93%E6%9E%9C)\n  - [安装](#%E5%AE%89%E8%A3%85)\n    - [macOS](#macos)\n    - [Ubuntu](#ubuntu)\n    - [Arch Linux](#arch-linux)\n    - [Void Linux](#void-linux)\n    - [Cargo (Linux,macOS,Windows)](#cargo-linuxmacoswindows)\n    - [二进制文件 (Linux,macOS,Windows)](#%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%96%87%E4%BB%B6-linuxmacoswindows)\n  - [名称的由来](#%E5%90%8D%E7%A7%B0%E7%9A%84%E7%94%B1%E6%9D%A5)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n# hyperfine\n\n[![Build Status](https://travis-ci.org/sharkdp/hyperfine.svg?branch=master)](https://travis-ci.org/sharkdp/hyperfine)\n[![Build status](https://ci.appveyor.com/api/projects/status/pdqq5frgkcj0smrs?svg=true)](https://ci.appveyor.com/project/sharkdp/hyperfine)\n[![Version info](https://img.shields.io/crates/v/hyperfine.svg)](https://crates.io/crates/hyperfine)\n\n命令行基准测试工具 (*灵感来自[bench](https://github.com/Gabriel439/bench)*) . \n\n**演示**: [`fd`](https://github.com/sharkdp/fd)和[`find`](https://www.gnu.org/software/findutils/) 的 基准测试:\n\n![hyperfine](https://i.imgur.com/5OqrGWe.gif)\n\n## 特征\n\n-   多次运行的统计分析. \n-   支持任意shell命令. \n-   关于基准进展和当前估计的持续反馈. \n-   可以在实际基准之前,预热执行. \n-   可以在每次定时运行之前，设置缓存清除命令. \n-   统计异常值检测. \n-   将结果导出为各种格式: CSV,JSON,Markdown. \n-   参数化基准. \n-   跨平台\n\n## 用法\n\n### 基本基准测试\n\n要运行基准测试，您只需调用即可`hyperfine \u003ccommand\u003e...`. 参数可以是任何shell命令. 例如: \n\n```bash\nhyperfine 'sleep 0.3'\n```\n\nHyperfine将自动确定要为每个命令执行的运行次数. 默认情况下，它将执行*至少*10个基准测试运行. 要更改此设置，您可以使用`-m`/`--min-runs`选项: \n\n```bash\nhyperfine --min-runs 5 'sleep 0.2' 'sleep 3.2'\n```\n\n### 注重 I/O 的程序\n\n如果程序执行时间受磁盘 I/O 限制，则基准测试结果可能会受到冷还是热的磁盘缓存严重影响. \n\n如果要在热缓存上运行基准测试，在实际基准测试之前可以使用`-w`/`--warmup`，执行一定数量的程序执行的选项(预热预热): \n\n```bash\nhyperfine --warmup 3 'grep -R TODO *'\n```\n\n相反，如果要运行冷缓存的基准测试，可以使用这个`-p`/`--prepare`选项， 在*每次*计时运行之前，运行特定命令. 例如，要清除Linux上的硬盘缓存，可以运行\n\n```bash\nsync; echo 3 | sudo tee /proc/sys/vm/drop_caches\n```\n\n要在 Hyperfine 中使用此特定命令，请`sudo -v`暂时获得sudo权限，然后调用: \n\n```bash\nhyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'grep -R TODO *'\n```\n\n### 参数化基准\n\n如果你想在一个参数变化的情况下运行基准测试 (比如线程数) ，你可以使用`-P`/`--parameter-scan`选项: \n\n```bash\nhyperfine --prepare 'make clean' --parameter-scan num_threads 1 12 'make -j {num_threads}'\n```\n\n### 导出结果\n\nHyperfine有多种导出基准测试结果的选项: CSV,JSON,Markdown (参见`--help`文字详情)。 例如，要将结果导出到Markdown，您可以使用`--export-markdown`，那将创建这样的表格: \n\n| Command | Mean [ms] | Min…Max [ms] |\n|:---|---:|---:|\n| `find . -iregex '.*[0-9]\\.jpg$'` | 506.0 ± 8.1 | 495.4…518.6 |\n| `find . -iname '*[0-9].jpg'` | 304.9 ± 3.1 | 299.8…309.3 |\n| `fd -HI '.*[0-9]\\.jpg$'` | 66.2 ± 5.8 | 62.5…86.3 |\n\n## 安装\n\n### macOS\n\nHyperfine可以通过[brew](https://brew.sh)安装: \n\n    brew install hyperfine\n\n### Ubuntu\n\n下载相应的`.deb`包，在[releases页面](https://github.com/sharkdp/hyperfine/releases)并通过`dpkg`安装它: \n\n```\nwget https://github.com/sharkdp/hyperfine/releases/download/v1.3.0/hyperfine_1.3.0_amd64.deb\nsudo dpkg -i hyperfine_1.3.0_amd64.deb\n```\n\n### Arch Linux\n\n在Arch Linux,可以通过[AUR](https://aur.archlinux.org/packages/hyperfine)安装hyperfine: \n\n    yaourt -S hyperfine\n\n### Void Linux\n\nHyperfine可以通过`xbps`安装:\n\n    xbps-install -S hyperfine\n\n### Cargo (Linux,macOS,Windows) \n\nHyperfine可以通过[cargo](https://doc.rust-lang.org/cargo/)安装: \n\n    cargo install hyperfine\n\n确保使用`Rust 1.24或更高版本`. \n\n### 二进制文件 (Linux,macOS,Windows) \n\n从[releases页面](https://github.com/sharkdp/hyperfine/releases)中下载相应的打包文件. \n\n## 名称的由来\n\n名字*hyperfine*是根据 铯133 的 hyperfine 能级选择的,铯133的这一能级的频率[定义了我们的基本时间单位-1秒钟](https://en.wikipedia.org/wiki/Second#History_of_definition) \n\n\u003e 译：（课外知识）李永乐老师, 一秒究竟有多长 [youtube](https://www.youtube.com/watch?v=cXX_f_pWLQI) | [bilibili](https://www.bilibili.com/video/av34102893?from=search\u0026seid=7806962251356954355)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinanf-boy%2Fhyperfine-zh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinanf-boy%2Fhyperfine-zh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinanf-boy%2Fhyperfine-zh/lists"}