From 6178238a0b069ae8ce65a23e3dd60c091de0cfef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 18 Mar 2017 16:46:10 +0100 Subject: output: Speed up layout calculations ``` BenchmarkLayout-4 4883 497 -89.82% benchmark old allocs new allocs delta BenchmarkLayout-4 18 1 -94.44% benchmark old bytes new bytes delta BenchmarkLayout-4 1624 32 -98.03% ``` --- output/layout_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'output/layout_test.go') diff --git a/output/layout_test.go b/output/layout_test.go index e678197ca..aa0657a36 100644 --- a/output/layout_test.go +++ b/output/layout_test.go @@ -73,4 +73,15 @@ func TestLayout(t *testing.T) { } }) } + +} + +func BenchmarkLayout(b *testing.B) { + descriptor := LayoutDescriptor{Kind: "taxonomyTerm", Section: "categories"} + l := NewLayoutHandler(false) + + for i := 0; i < b.N; i++ { + layouts := l.For(descriptor, "", HTMLType) + require.NotEmpty(b, layouts) + } } -- cgit v1.2.3