aprescott/serif — pull request #29 by aprescott (2013-02-18 14:14:18+00:00)
Title: Improve performance of post generation with caches

Spent some time looking at performance profiles recently and managed to get some speed-ups.

* YAML `_config.yml` reads are cached. There's currently nowhere in the application that the config files can change.
* It turns out that one of biggest wastes of time in generating posts is reading out `#headers` because it has to construct a full copy. The result is cached now and the cache is invalidated in a few tests. Need to spend some more time thinking about this one and where extra tests need to be added to ensure caches are invalidated.

I've also added a `rake stress` test which does a crude performance benchmark: creates a new blog with `serif new`, creates 250 new posts in `_posts/` and then calls `time serif generate`.

Before this patch:

```
3.85 real 3.64 user 0.20 sys
```

After:

```
1.15 real 1.02 user 0.12 sys
```

Roughly a 70% reduction in time.