mirror of
https://github.com/octoleo/restic.git
synced 2025-02-02 03:48:25 +00:00
5d4568d393
This writes files by using (*os.File).Truncate, which resolves to the truncate system call on Unix. Compared to the naive loop, for _, b := range p { if b != 0 { return false } } the optimized allZero is about 10× faster: name old time/op new time/op delta AllZero-8 1.09ms ± 1% 0.09ms ± 1% -92.10% (p=0.000 n=10+10) name old speed new speed delta AllZero-8 3.84GB/s ± 1% 48.59GB/s ± 1% +1166.51% (p=0.000 n=10+10)