From b5bced1db4c731a3e1e5be032df4929085a80fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 24 Mar 2016 15:05:40 +0100 Subject: [PATCH] Add a simple benchmark for Scratch --- hugolib/scratch_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hugolib/scratch_test.go b/hugolib/scratch_test.go index f81564c88..8bc5db016 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") + } +}