mirror of
https://github.com/restic/restic.git
synced 2026-01-17 20:33:07 -05:00
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)
|
||
|---|---|---|
| .. | ||
| doc.go | ||
| filerestorer.go | ||
| filerestorer_test.go | ||
| fileswriter.go | ||
| fileswriter_test.go | ||
| hardlinks_index.go | ||
| hardlinks_index_test.go | ||
| preallocate_darwin.go | ||
| preallocate_linux.go | ||
| preallocate_other.go | ||
| preallocate_test.go | ||
| restorer.go | ||
| restorer_test.go | ||
| restorer_unix_test.go | ||
| sparsewrite.go | ||