From d8e1482abe67bcdef8f55bb5892c50c3f0253a22 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 1 May 2015 23:52:36 +0200 Subject: [PATCH] Add benchmark for Node.fillExtra --- node_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 node_test.go diff --git a/node_test.go b/node_test.go new file mode 100644 index 000000000..e82b35a18 --- /dev/null +++ b/node_test.go @@ -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) + } +}