commit b5bced1db4c731a3e1e5be032df4929085a80fa2
parent 7c84e6b3e32bdb61a6a11d34545f4177db8e92fa
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Thu, 24 Mar 2016 15:05:40 +0100
Add a simple benchmark for Scratch
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/hugolib/scratch_test.go b/hugolib/scratch_test.go
@@ -143,3 +143,12 @@ func TestScratchGetSortedMapValues(t *testing.T) {
t.Errorf("Should not return anything, but got %v", nothing)
}
}
+
+func BenchmarkScratchGet(b *testing.B) {
+ scratch := newScratch()
+ scratch.Add("A", 1)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ scratch.Get("A")
+ }
+}