attic
attic copied to clipboard
Optimization: asynchronous writeback
fsync() after each segment write is suboptimal :). It means you stop (cpu) processing to wait for the physical disk write. And the default segment size is 5MB. (I noticed bup avoids this issue by writing pack files of 1GB by default :).
Improvements will vary depending disk/cpu speed. (I guess the worst case was when they were evenly matched).
- Writing 65M on SheevaPlug "NAS" went from 47s to 45s.
- 920M on desktop HDD (read from SSD) went from 68s to 45s
Obviously there's a few lines of code here, but it's not intrusive. I tried to keep it as simple as possible.
It's still slightly clever, but there's no point using python if you're not going to pass a few closures between threads :).