TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Hyperfine: A command-line benchmarking tool

241 点作者 hundredwatt6 个月前

10 条评论

ratrocket6 个月前
Perhaps interesting (for some) to note that hyperfine is from the same author as at least a few other &quot;ne{w,xt} generation&quot; command line tools (that could maybe be seen as part of &quot;rewrite it in Rust&quot;, but I don&#x27;t want to paint the author with a brush they disagree with!!): fd (find alternative; <a href="https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;fd">https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;fd</a>), bat (&quot;supercharged version of the cat command&quot;; <a href="https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;bat">https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;bat</a>), and hexyl (hex viewer; <a href="https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;hexyl">https:&#x2F;&#x2F;github.com&#x2F;sharkdp&#x2F;hexyl</a>). (And certainly others I&#x27;ve missed!)<p>Pointing this out because I myself appreciate comments that do this.<p>For myself, `fd` is the one most incorporated into my own &quot;toolbox&quot; -- used it this morning prior to seeing this thread on hyperfine! So, thanks for all that, sharkdp if you&#x27;re reading!<p>Ok, end OT-ness.
评论 #42186890 未加载
mmastrac6 个月前
Hyperfine is a great tool but when I was using it at Deno to benchmark startup time there was a lot of weirdness around the operating system apparently caching inodes of executables.<p>If you are looking at shaving sub 20ms numbers, be aware you may need to pull tricks on macos especially to get real numbers.
评论 #42182037 未加载
评论 #42180391 未加载
评论 #42182986 未加载
usrme6 个月前
I&#x27;ve also had a good experience using the &#x27;perf&#x27;[^1] tools for when I don&#x27;t want to install &#x27;hyperfine&#x27;. Shameless plug for a small blog post about it as I don&#x27;t think it is that well known: <a href="https:&#x2F;&#x2F;usrme.xyz&#x2F;tils&#x2F;perf-is-more-robust-for-repeated-timings-than-time&#x2F;" rel="nofollow">https:&#x2F;&#x2F;usrme.xyz&#x2F;tils&#x2F;perf-is-more-robust-for-repeated-timi...</a>.<p>---<p>[^1]: <a href="https:&#x2F;&#x2F;www.mankier.com&#x2F;1&#x2F;perf" rel="nofollow">https:&#x2F;&#x2F;www.mankier.com&#x2F;1&#x2F;perf</a>
评论 #42181740 未加载
评论 #42182900 未加载
mosselman6 个月前
Hyperfine is great. I use it sometimes for some quick web page benchmarks:<p><a href="https:&#x2F;&#x2F;abuisman.com&#x2F;posts&#x2F;developer-tools&#x2F;quick-page-benchmarks" rel="nofollow">https:&#x2F;&#x2F;abuisman.com&#x2F;posts&#x2F;developer-tools&#x2F;quick-page-benchm...</a><p>As mentioned here in the thread, when you want to go into the single ms optimisations it is not the best approach since there is a lot of overhead especially the way I demonstrate here, but it works very well for some sanity checks.
评论 #42183449 未加载
评论 #42183124 未加载
smartmic6 个月前
A capable alternative based on &quot;boring, old&quot; technology is multitime [1]<p>Back at the time I needed it, it had peak memory usage - hyperfine was not able to show it. Maybe this had changed by now.<p>[1] <a href="https:&#x2F;&#x2F;tratt.net&#x2F;laurie&#x2F;src&#x2F;multitime&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tratt.net&#x2F;laurie&#x2F;src&#x2F;multitime&#x2F;</a>
jamietheriveter6 个月前
The comment about statistics that I wanted to reply to has disappeared. That commenter said:<p>&gt; I stand firm in my belief that unless you can prove how CLT applies to your input distributions, you should not assume normality. And if you don&#x27;t know what you are doing, stop reporting means.<p>I agree. My research group stopped using Hyperfine because it ranks benchmarked commands by mean, and provides standard deviation as a substitute for a confidence measure. These are not appropriate for heavy-tailed, skewed, and otherwise non-normal distributions.<p>It&#x27;s easy to demonstrate that most empirical runtime distributions are not normal. I wrote BestGuess [0] because we needed a better benchmarking tool. Its analysis provides measures of skew, kurtosis, and Anderson-Darling distance from normal, so that you can see how normal or not is your distribution. It ranks benchmark results using non-parametric methods. And, unlike many tools, it saves <i>all</i> of the raw data, making it easy to re-analyze later.<p>My team also discovered that Hyperfine&#x27;s measurements are a bit off. It reports longer run times than other tools, including BestGuess. I believe this is due to the approach, which is to call getrusage(), then fork&#x2F;exec the program to be measured, then call getrusage() again. The difference in user and system times is reported as the time used by the benchmarked command, but unfortunately this time also includes cycles spent in the Rust code for managing processes (after the fork but before the exec).<p>BestGuess avoids external libraries (we can see <i>all</i> the relevant code), does almost nothing after the fork, and uses wait4() to get measurements. The one call to wait4() gives us what the OS measured by its own accounting for the benchmarked command.<p>While BestGuess is still a work in progress (not yet at version 1.0), my team has started using it regularly. I plan to continue its development, and I&#x27;ll write it up soon at [1].<p>[0] <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;JamieTheRiveter&#x2F;bestguess" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;JamieTheRiveter&#x2F;bestguess</a> [1] <a href="https:&#x2F;&#x2F;jamiejennings.com" rel="nofollow">https:&#x2F;&#x2F;jamiejennings.com</a>
edwardzcn6 个月前
Hyperfine is great! I remember I learned about it when comparing functions with&#x2F;without tail recursion (not sure if it was from the Go reference or the Rust reference). It provides simple configurations for unit test. But I have not tried it on DBMS (e.g. like sysbench). Does anyone have a try?
7e6 个月前
What database product does the community commonly send benchmark results to? This tool is great, but I&#x27;d love to analyze results relationally.
评论 #42197093 未加载
评论 #42182961 未加载
accelbred6 个月前
Hyperfine is a really useful tool.<p>Weirdest thing I&#x27;ve used it for is comparing io throughput on various disks.
forrestthewoods6 个月前
Hyperfine is hyper frustrating because it only works with really really fine microsecond level benchmarks. Once you get into the millisecond range it’s worthless.
评论 #42182084 未加载
评论 #42180660 未加载