Add benchmark for Node.fillExtra
This commit is contained in:
parent
d753a5ffa3
commit
d8e1482abe
1 changed files with 27 additions and 0 deletions
27
node_test.go
Normal file
27
node_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package restic
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func BenchmarkNodeFillUser(t *testing.B) {
|
||||
tempfile, err := ioutil.TempFile("", "restic-test-temp-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fi, err := tempfile.Stat()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
node := &Node{}
|
||||
path := tempfile.Name()
|
||||
|
||||
t.ResetTimer()
|
||||
|
||||
for i := 0; i < t.N; i++ {
|
||||
node.fillExtra(path, fi)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue