wycats/handlebars.js — pull request #412 by kpdecker (2013-01-21 07:12:28+00:00)
Title: Inline ops

Implements a variety of performance improvements:

1. Allows stack operations to be inlined via the `,` operator. In many cases this allows us to skip a stack variable or in the case of hashes, inline the hash object as a literal.
2. Merge consecutive buffer concatenation into a single statement
3. Reuse identical programs rather than emitting multiple times
4. Create options register rather than emitting the literal multiple times.

These changes dropped the javascript payload on my project (already running in knownHelpers etc) by about 15kb after minimization (uglify) and about 3kb after gzip.

@wycats Opening a pull request on this as it has some fairly large impact on th readability of the generated template, which may or may not be a concern.

An example of the output:
```
buffer += "This is content\n"
+ "\nThis is more content\n";
if (stack1 = helpers.mustache) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.mustache; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "\ntest\n"
+ escapeExpression(helpers['if'].call(depth0, {hash:{},data:data}))
+ "\ntest\n";
options = {hash:{
'foo': (((stack1 = depth0.bar),stack1 == null || stack1 === false ? stack1 : stack1.bak)),
'bat': ("bat")
},data:data};
buffer += escapeExpression(((stack1 = helpers.helper),stack1 ? stack1.call(depth0, 1, "2", depth0.id, options) : helperMissing.call(depth0, "helper", 1, "2", depth0.id, options)))
+ "\n";

```

Clipped from:
```
This is content
{{! This is a comment}}
This is more content
{{mustache}}
test
{{if}}
test
{{helper 1 "2" id foo=bar.bak bat="bat"}}
```