chef-server icon indicating copy to clipboard operation
chef-server copied to clipboard

Find faster with fewer execs

Open feld opened this issue 1 year ago • 2 comments

chef-server-ctl reconfigure runs incredibly slow because it has to fork off chmod for every applicable file instead of targeting as many files as possible with a single chmod execution.

Before:

$ time sudo find /opt/cinc-project/embedded/lib/ruby/gems/*/gems -perm /u=x,g=x,o=x -exec chmod 755 {} \;

real    0m5.223s
user    0m0.004s
sys     0m0.006s

$ time sudo find /opt/cinc-project/embedded/lib/ruby/gems/*/gems -perm /u=r,g=r,o=r ! -perm /u=x -exec chmod 644 {} \;

real    0m22.883s
user    0m0.001s
sys     0m0.008s

almost 30 seconds 😭

After:

$  time sudo find /opt/cinc-project/embedded/lib/ruby/gems/*/gems -perm /u=x,g=x,o=x -exec chmod 755 {} \+

real    0m0.177s
user    0m0.006s
sys     0m0.013s

$ time sudo find /opt/cinc-project/embedded/lib/ruby/gems/*/gems -perm /u=r,g=r,o=r ! -perm /u=x -exec chmod 644 {} \+

real    0m0.312s
user    0m0.011s
sys     0m0.001s

about 0.5 seconds...

feld avatar May 29 '24 20:05 feld

Deploy Preview for chef-server processing.

Name Link
Latest commit 43f0d594a9f65004056c504609b7cde2a96c78fe
Latest deploy log https://app.netlify.com/sites/chef-server/deploys/665792e82054b300080534ab

netlify[bot] avatar May 29 '24 20:05 netlify[bot]