shithub: hugo

Download patch

ref: b5bced1db4c731a3e1e5be032df4929085a80fa2
parent: 7c84e6b3e32bdb61a6a11d34545f4177db8e92fa
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Mar 24 11:05:40 EDT 2016

Add a simple benchmark for Scratch

--- a/hugolib/scratch_test.go
+++ b/hugolib/scratch_test.go
@@ -143,3 +143,12 @@
 		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")
+	}
+}