I've found a use for APFS' copy-on-write cloned files.
I like to work with git worktrees, and I work on an app that has a large (2 gb) node_modules directory.
Previously, every time I made a worktree, I had to `npm install` to get a fresh node_modules, or copy the full directory, which was slow.
$ time /bin/cp -r node_modules /tmp/node_modules
/bin/cp -r node_modules /tmp/node_modules 1.98s user 58.26s system 63% cpu 1:34.17 total
The -c option to /bin/cp on a mac is "copy files using clonefile(2)", making clones instead of full copies. It's still not super fast, but almost a minute less of waiting for the copy is a nice improvement: $ time /bin/cp -rc node_modules /tmp/node_modules_cloned
/bin/cp -rc node_modules /tmp/node_modules_cloned 0.43s user 29.85s system 79% cpu 38.211 total
The one downside is that GNU has an incompatible option for creating clones (`--reflink`), leading to this very ugly conditional:https://github.com/llimllib/personal_code/blob/0e1034f13b31f...