Which is faster, 'find -exec' or 'find | xargs -0'?

前端 未结 4 813
执念已碎
执念已碎 2021-01-05 10:14

In my web application I render pages using PHP script, and then generate static HTML files from them. The static HTML are served to the users to speed up performance. The HT

4条回答
  •  佛祖请我去吃肉
    2021-01-05 10:58

    I expect the xargs version to be slightly faster as you aren't spawning a process for each filename. But, I would be surprised if there was actually much difference in practice. If you're worried about the long list xargs sends to each invocation of rm, you can use -l with xargs to limit the number of tokens it will use. However, xargs knows the longest cmdline length and won't go beyond that.

提交回复
热议问题