Earlier quoted context omitted.
The idea is to rename it so that you don't have to wait for it to be deleted. You can let the deletion run in the background once it has been moved out of the way.
And to be totally, ridiculously pedantic (this is HN after all) mv is a single atomic metadata operation in the filesystem, which will almost certainly go into the filesystem log without any wait on i/o. A big rm is going to generate enough metadata churn that the filesystem log will need to be synced to hardware at least once, and then you've got 2 or 3 orders of magnitude more time to wait (per sync).
The fastest rm command and one of the fastest cp commands
31–40 of 83 posts
Re: The fastest rm command and one of the fastest cp commands
#32Re: The fastest rm command and one of the fastest cp commands
#33On windows I find it's much faster to use robocopy to mirror an empty folder into a full one than it is to delete the full folder than pretty much any other command. I regularly have to delete a 200GB folder with 500k+ files in it, and robocopy outperforms regular rm -r by a factor of two, and GUI shift+right click delete by a factor of 4 or 5.
Re: The fastest rm command and one of the fastest cp commands
#34I once wrote a command called trickle-rm, which was designed to be an i/o constrained rm, this the exact opposite of this article. I needed trickle-rm because after extensive analysis, I'd found that the i/o load of a diagnostic data cleanup job was interfering with the very tight latency requirements of the main app on the server. My first effort was "nice rm -rf $oldLogs". When I'm feeling a bit evil I will ask an…
Re: The fastest rm command and one of the fastest cp commands
#35I once wrote a command called trickle-rm, which was designed to be an i/o constrained rm, this the exact opposite of this article. I needed trickle-rm because after extensive analysis, I'd found that the i/o load of a diagnostic data cleanup job was interfering with the very tight latency requirements of the main app on the server. My first effort was "nice rm -rf $oldLogs". When I'm feeling a bit evil I will ask an…
Why didn't it work? Was try 2 ionice?
Re: The fastest rm command and one of the fastest cp commands
#36Hmm. I appreciate the cute name for the project but I tested this on my machine (a Mac) and the results were not very impressive. I sacrificed a few of my SSD cycles to test how this is on deleting Xcode (for those unaware, it's a 11 GB mess of several hundred thousand files of varying sizes). Here are the results: $ time rm -rf Xcode.app real 0m39.850s user 0m0.429s sys 0m29.153s $ time rmz Xcode.app real 0m36.476s…
Slight tangent: why do you need to delete Xcode so often? (I don't really develop on Mac, mostly on Linux.)
Not the reason OP is deleting Xcode, but you'd be surprised at how buggy a lot of stuff involving Xcode can be.
Re: The fastest rm command and one of the fastest cp commands
#37> The key insight is that file operations in separate directories don’t (for the most part) interfere with each other, enabling parallel execution. i'm clearly missing something here parallel execution helps when operations are cpu bound file operations are (almost always) io bound and totally unclear how directories represent an "interference" boundary bizarre
The question is, how independent are IO operations in separate directories. And the article is claiming that they're fairly independent and don't block each other.
Re: The fastest rm command and one of the fastest cp commands
#38Earlier quoted context omitted.
I don't think any GUI move items before a confirmation, so I don't see the link at all.
They almost universally do! They move stuff to a designated trash or recycle bin or whatever to stage for final deletion when you commit to it.
To rephrase:
> mv dir .old-dir && rm -r .old-dir &
it's how most GUI desktops “delete” stuff, they just run the two actions separately
It's kind of a stretch anyway since the core idea of the command was the final `&`
Re: The fastest rm command and one of the fastest cp commands
#39If you need a large sub tree gone, mv dir .old-dir && rm -r .old-dir & works pretty well. Faster even than an optimized parallel unlinker.
Why would running mv before rm be faster? On what file systems is this true?
Re: The fastest rm command and one of the fastest cp commands
#40Hmm. I appreciate the cute name for the project but I tested this on my machine (a Mac) and the results were not very impressive. I sacrificed a few of my SSD cycles to test how this is on deleting Xcode (for those unaware, it's a 11 GB mess of several hundred thousand files of varying sizes). Here are the results: $ time rm -rf Xcode.app real 0m39.850s user 0m0.429s sys 0m29.153s $ time rmz Xcode.app real 0m36.476s…
[1] https://github.com/SUPERCILEX/fuc/tree/master/comparisons