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%
```
This commit is contained in:
Bjørn Erik Pedersen
2017-03-18 16:46:10 +01:00
parent df95383914
commit 6178238a0b
4 changed files with 42 additions and 4 deletions

View File

@@ -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)
}
}