binpash / try

Inspect a command's effects before modifying your live system
MIT License
5.21k stars 68 forks source link

Measuring and optimizing try's overhead #156

Open ezrizhu opened 6 months ago

ezrizhu commented 6 months ago

Below loop takes 0.086338005s https://github.com/binpash/try/blob/55a76199cbe5d564430f246f72100f22124161db/try#L109-L117

each unionhelper mount takes around 0.011723267s each normal overlay mount takes around 0.005518701s

0.004118806 Entrypoint
0.001737423 Finish Parseopt
0.001615350 Start of try()
0.003911111 Determining sandboxdir
0.009549844 Docker handling
0.004255040 Making upperdir, workdir, temproot
0.004132450 Enumerating direcotories to mount
0.006334729 EnumDir: find
0.006502962 EnumDir: findmnt
0.003777117 EnumDir: sort
0.005552995 EnumDir: MultiLowerDir
0.084236389 Prepare sandboxes before unshare
0.005717082 set temproot permission
0.016709205 Writing tempfiles
0.001816768 Disable job control
0.005136067 Outer unshare
0.001934788 Union helper detection
0.105242101 Mounting overlays
0.030229675 Mounting devices
0.012676495 Inner unshare
0.009892223 sync
0.029609429 unmounting devices
0.011026003 Exitting inner unshare
0.019649394 Symlinks cleanup
0.008201226 Summary
0.001717618 End of try
0.001631593 date test 1
mgree commented 6 months ago

Interesting! Is there a way for you to automate this process and check the overheads on a few different machines?

Can you count the overhead of the two calls to date, too? (You can do this by just running it with an empty block.)

ezrizhu commented 6 months ago

sure, i'll do them on our CI machine under different distros and also some of my other machines

ezrizhu commented 5 months ago

Can you count the overhead of the two calls to date, too? (You can do this by just running it with an empty block.) updated, see date test 1

Dev VM: https://bns.sh/i3.txt Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz (40): http://bns.sh/iC.txt Intel(R) Xeon(R) CPU E3-1230 v5 @ 3.40GHz (8): http://bns.sh/iY.txt AMD Ryzen 7 3700X 8-Core Processor (16): https://bns.sh/iR.txt

I'll work with @gliargovas to get them ran on the pi cluster at brown aswell, then setting up some CI jobs to automatically run them after we determine the machine set that we're using.