mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user