> In 2022, we shouldn't be reserving any area of a file as 'spare space' like this.
In 2022, we should have file formats that are not naive of the underlying filesystem. I store my text notes in Git, but I also have two LibreOffice documents in there because org-mode doesn't handle their contents well. It would be nice of only 5% of the file had to be rewritten when I change a single word, rather than the current 91% of the file. A 5% hit to storage for a 91% reduction each time I update it would be a great trade off.I’ve never tried this, so take it with a heap of salt, but you might have better luck with the diffing if you developed a process that unzipped the file contents into your repo after you’re done editing it, and then zipped the contents back up with the right extension when you want to edit it again.
Alternatively, you could just switch to a text-based format like rtf, as long as you don’t need any specific features from odt or docx.
(EDIT: someone else mentions a promising sounding “flat xml” format, which I’ve never encountered before.)
I have a current project where one of the other developers has tried this. It might work for a solo project, but with multiple developers on Windows (Excel) and Linux (Open Office), I find that Open Office feels a need to continually fuck with unrelated fields. Editing a single field in an xslx file results in changes in a dozen files in the unpacked version. Making any more complicated changes results in a diff that's impossible to manage.
Still, interesting to hear some feedback on how well (or not) that idea has worked for some.
The Flat XML option seems to be the best approach if you need to edit documents more complex than what can be represented in either markdown or rtf (rich text format).
$ ls -hl todo.fodt
-rw-rw-r-- 1 dotancohen dotancohen 150K Apr 7 16:41 todo.fodt
$ ls -hl todo.odt
-rwxrwxr-x 1 dotancohen dotancohen 117K Apr 6 12:01 todo.odt
$ wc -l todo.fodt
1983 todo.fodt
$ cp todo.fodt todo-edit-one-line.fodt
$ libreoffice todo-edit-one-line.fodt
$ diff todo.fodt todo-2.fodt | grep "+ " | wc -l
19However SQLite stores multiple files on disk for crash persistence, complicating matters. But then again so does Audacity 2, and Microsoft Office to an extent (file locking rather than data integrity).
Microsoft Word used to only append changes to the document on save rather than rewriting the whole file, but this was disabled since if you deleted text and saved the file, it remained in the document. https://www.cnet.com/culture/microsoft-disabling-word-2003s-...
Those 0.5 MB presumably also need to be written to disk, making this a trading away of 392 TB in disk writes in exchange for 17 PB over the wire + 17 PB in disk writes? I'm sure this is overly simple and overlooks a lot of technical details, but I can't see how this can be worth it.
[1]: https://www.businessofapps.com/data/apple-music-statistics/
I completely understand your point, but maybe it would be a breaking change.
On the very rare occasion you adjust the artists name in a music file, the user expects the whole file will be rewritten. So just rewrite the whole file.
Whats next? Photoshop only writing out a quarter of an image when I edit my ex out of a nice photo? MS Word only touching a few bytes of a 100 page document when I make a heading bold?