From: Bjørn Erik Pedersen Date: Thu, 24 Mar 2016 14:05:40 +0000 (+0100) Subject: Add a simple benchmark for Scratch X-Git-Tag: v0.16~165 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b5bced1db4c731a3e1e5be032df4929085a80fa2;p=brevno-suite%2Fhugo Add a simple benchmark for Scratch --- diff --git a/hugolib/scratch_test.go b/hugolib/scratch_test.go index f81564c8..8bc5db01 100644 --- 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") + } +}