The saddest script I ever wrote
blog.snailtext.com
blog.snailtext.com
- https://docs.docker.com/storage/bind-mounts/#configure-mount...
Due to it is being VM, contents are synced between host and VM. It takes time and damages IOPS greatly. Eg. Even running ~100MB Jar takes minutes...
Side note that vim uses `swap` files `.$FILE.swp` when you write out, it removes the original file renames the temporary one to original one. So essentially inode or reference is different thats why it triggers sync with VM.
Ed probably writes files in-place.
Docker now uses inotify equalivent (fswatch?) on macOS, which is pretty much reliable than polling. Ofc if your app did not close file with exclusive read-write-lock, docker cannot do anything about it.
This is a choice that I feel would benefit from some kind of explenation
Oh mate, I don't think that's the issue here! This is like breaking your host OS and then making it pantomime it's own replacement so you can pretend you still have a working OS!
At some point, the container got optimized to not need the sync anymore for acceptable load times. Nobody is sure what we changed to help that out. ️
I would assume the root of the difference in behavior comes down to calling fsync when editing files on such a mount.
In lieu of having macOS's userland source I grepped through through copies of ed's source from GNU and OpenBSD. I don't see any calls to fsync. Whereas Vim by default does. Note most instances of vi are actually a link to Vim/a minimal version of Vim. Normally I'd test this with with some quick tracing but it appears I've not configured SIP to allow DTrace on my machine and I can't be bothered to reboot right now.
I wonder though, how different are the file edited with ed and the one edited with vi. Maybe ed fails to update the "date modified" under these conditions?