hugolib: Add a cache to GetPage
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 25 May 2017 18:13:03 +0000 (21:13 +0300)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 26 May 2017 07:42:45 +0000 (10:42 +0300)
commit50d11138f3e18b545c15fadf52f7b0b744bf3e7c
tree1b3a31b7e24cfd5a290adf92db7842a13458e91a
parente0c2e798201f75ae6e9a81a7442355288c2d141b
hugolib: Add a cache to GetPage

Looks to be slightly slower with the low number of section pages, but the 1000 regular pages seem to add value.

```
benchmark                     old ns/op     new ns/op     delta
BenchmarkGetPage-4            97.7          145           +48.41%
BenchmarkGetPageRegular-4     7933          161           -97.97%

benchmark                     old allocs     new allocs     delta
BenchmarkGetPage-4            0              0              +0.00%
BenchmarkGetPageRegular-4     0              0              +0.00%

benchmark                     old bytes     new bytes     delta
BenchmarkGetPage-4            0             0             +0.00%
BenchmarkGetPageRegular-4     0             0             +0.00%
```
hugolib/page.go
hugolib/page_collections.go