agoragames/stache — pull request #43 by MarkusHarmsen (2014-09-01 13:23:42+00:00)
Title: Cache compiled templates between requests

### Story
I was wondering how the stache gem performs compared to the classical ERB rendering. When digging in the source, it seems that stache does not cache any compiled templates (via mustache) and is maybe therefore slower than expected.

Are there any reasons why the mustache caching has not been utilized?

For testing purposes, I've attached a simple commit which adds caching - the rspec test seem to be successful.

### Setup
New clean Rails 4.1.5 application with two nearly identical controllers. One renders an erb-template, the other uses mustache + stache as engine. Thin was used as webserver in production mode and siege via ```siege http://localhost:3000/mustache -t1m``` to create load for one minute.

### Layout
```HTML

MustacheTest

##Mustache#################

{{{yield}}}

```
*The ERB template is analogue and therefore not shown here*

### View
```HTML
hello world

```

### Results
Version | trans/sec
-----------|--------------
Stache (1.0.3) | 388
Stache (1.0.3 + Cache) | 463
ERB | 525

### Notes
* A very small layout / view has been used, so that the performance *boost* might be even more on complex ones
* This is only tested via the rspec tests, so no guarantee that this may be totally crap ;)