10000条数据删除速率对比 find 自带的delete参数更胜一筹
for i in {1..10000};do echo hello >> $i.txt;done
# 直接使用rm
[root@xui test]# time rm -rf *
real 0m0.229s
user 0m0.036s
sys 0m0.188s
# exec
[root@xui test]# time find . -type f -exec rm {} \;
real 0m11.225s
user 0m3.229s
sys 0m7.611s
#xargs
[root@xui test]# time find . -type f |xargs rm
real 0m0.215s
user 0m0.025s
sys 0m0.190s
#find delete
[root@xui test]# time find . -type f -delete
real 0m0.191s
user 0m0.014s
sys 0m0.174s

浙公网安备 33010602011771号