serpent-os / boulder-d-legacy

Replaced by Rust tooling
https://serpentos.com
21 stars 7 forks source link

cli/delete_cache: parallelize deleteDir() #66

Closed joebonrichie closed 1 year ago

joebonrichie commented 1 year ago

Firstly we walk the path and create an array of files and directories, we then delete the array of files in parallel, then finally we delete the directories from the bottom up.

A few approaches were tried, this ended up being the fastest.

Test Case (Avg. 10 runs)

$ boulder build nano.yml $ cp /var/cache/boulder/root ~/root-testcase $ du -sh ~/root-testcase : 2.0 GiB

rmdirRecurse : 988ms deleteDir (old) : 940ms deleteDir (parallel) : 737ms

Tested on an NVME SSD, it's possible this may be slower on spinning rust.

ermo commented 1 year ago

I like it.