coffeecup-vs-coffee-templates

JavaScript performance comparison

Revision 4 of this test case created

Info

benching my minimalist alternative to the official lib

Preparation code

<script src="http://mikesmullin.github.com/haml-html-coffeecup-javascript-coffeescript-converter/coffeecup.js"></script>
<script src="http://mikesmullin.github.com/coffee-templates/js/coffee-templates.js"></script>
<script>
Benchmark.prototype.setup = function() {
    var data, ct, template;
   
    ct = new CoffeeTemplates({
      format: true
    });
   
    template = function() {
      doctype(5);
      return html(function() {
        head(function() {
          return title(this.title);
        });
        return body(function() {
          div({
            id: 'content'
          }, function() {
            var post, _i, _len, _ref, _results;
            _ref = this.posts;
            _results = [];
            for (_i = 0, _len = _ref.length; _i < _len; _i++) {
              post = _ref[_i];
              _results.push(div({
                "class": 'post'
              }, function() {
                p(post.name);
                return div(post.comment);
              }));
            }
            return _results;
          });
          return form({
            method: 'post'
          }, function() {
            return ul(function() {
              li(function() {
                return input({
                  name: 'name'
                });
              });
              li(function() {
                return textarea({
                  name: 'comment'
                });
              });
              return li(function() {
                return input({
                  type: 'submit'
                });
              });
            });
          });
        });
      });
    };
   
    data = {
      title: 'my first website!',
      posts: [{ name: 'bob', comment: 'hi'},{ name: 'jim', comment: 'bye'}]
    };
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
CoffeeCup
coffeecup.compile(template)(data)

 
pending…
Coffee-Templates
ct.render(template, data)
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment