Huge speedup: sync all files at once instead of syncing them seperately
Submitted by Jann Horn
Assigned to Shared Mime Info group
Description
Created attachment 104741 my patch
First write all files, then sync all filesystems, then move all files. The original behavior was very slow for two reasons:
- After every file creation, we had to wait for the harddisk to complete the write.
- We told the kernel and the harddisk in which order writes should happen.
This reduces the time needed on my harddisk from 44-45s to 0.9-1.4s. More than an order of magnitude speedup! :)
The only downside I can see is that if update-mime-database is interrupted for some reason, there are more *.new files in the FS. I don't think that that's a big problem.
Attachment 104741, "my patch":
0001-factor-40-speedup.patch