当我执行时cp folder1 folder2 -rf
,第一次大约需要10分钟。但是当我执行第二个命令时cp folder1 folder3 -rf
,大约需要 1 分钟。folder1
包含大约 100 000 个文件。
为什么第二次运行时间会有所改善?
这是因为页面缓存。跑步sync ; echo 3 > /proc/sys/vm/drop_caches
让它再次变慢。
进一步阅读:
- http://jim.studt.net/depository/index.php/flushing-caches-for-benchmarking-in-linux http://jim.studt.net/depository/index.php/flushing-caches-for-benchmarking-in-linux
- https://superuser.com/a/319287/236874 https://superuser.com/a/319287/236874
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)