bash-loops:各种 BASH 循环的基准

时间:2021-06-19 22:25:28
【文件属性】:
文件名称:bash-loops:各种 BASH 循环的基准
文件大小:3KB
文件格式:ZIP
更新时间:2021-06-19 22:25:28
Ruby 在 BASH 中运行n 个交互的最快方法是什么? tl;dr for i in {0..1000} ; 这是最快的。 背景 我偶然在 *.com 上看到。 然后,我想知道:我可以在 BASH 中运行命令n次的最快方法是什么? 经过一些快速的谷歌搜索,我对结果并不满意。 所以,我决定亲自测试一下。 我的系统 Linux 3.18.6-1-ARCH x86_64 GNU/Linux bash 4.3.33(1)-release seq (GNU coreutils) 8.23 ruby 2.2.0p0 benchmark-ips 2.1.1 结果 i/ps 是通过 5 秒样本计算得出的。 # n = 1000 for {0..1000}: 150.5 (±25.3%) i/s for seq $(0 1000): 1
【文件预览】:
bash-loops-master
----loops()
--------seq.sh(38B)
--------while-db.sh(59B)
--------expan.sh(34B)
--------for.sh(43B)
--------while-sb.sh(57B)
--------while-read-line.sh(44B)
----Gemfile(51B)
----README.md(2KB)
----.gitignore(23B)
----benchmark.rb(533B)

网友评论