mirror of https://github.com/restic/restic.git
Add benchmark for NodeFromFileInfo
This commit is contained in:
parent
9308f1493d
commit
ccdbc80d5b
25
node_test.go
25
node_test.go
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
func BenchmarkNodeFillUser(t *testing.B) {
|
||||
tempfile, err := ioutil.TempFile("", "restic-test-temp-")
|
||||
defer tempfile.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -25,3 +26,27 @@ func BenchmarkNodeFillUser(t *testing.B) {
|
|||
node.fillExtra(path, fi)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkNodeFromFileInfo(t *testing.B) {
|
||||
tempfile, err := ioutil.TempFile("", "restic-test-temp-")
|
||||
defer tempfile.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fi, err := tempfile.Stat()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
path := tempfile.Name()
|
||||
|
||||
t.ResetTimer()
|
||||
|
||||
for i := 0; i < t.N; i++ {
|
||||
_, err := NodeFromFileInfo(path, fi)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue