这需要 2 分 9 秒,我不知道为什么:
time openssl rand 10000000 > foo
这需要 0.8 秒:
time openssl rand 10000000 | sponge > foo
系统:Ubuntu 16.04.1、HP Stream Mini 010、4TB USB 3.0 Seagate“Backup Plus”硬盘。
为什么使用 sponge 的速度提高了 161 倍?
更多测试...
同一硬盘驱动器在 Mac 上重新格式化为 HFS+,同样的两个测试分别产生 1.09 秒和 0.9 秒。
Mac、Parallels 和 Ubuntu 14.04 工作速度更快:分别为 0.4 秒和 0.2 秒。
最佳答案
sponge有自己的buffer,写一步到位。 海绵宝宝:
DESCRIPTION
sponge reads standard input and writes it out to the specified file.
Unlike a shell redirect, sponge soaks up all its input before writing
the output file.
关于linux - 写入 USB 硬盘非常慢,但不是 'sponge',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40623085/