Smarty past test 2

JavaScript performance comparison

Test case created by romis

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://jsmart.googlecode.com/files/smart-2.9.min.js">
</script>
<script id="test_tpl" type="text/x-jsmart-tmpl">
  <h1>{$greeting}</h1>
   {foreach $books as $i => $book}
      <div>
         [{$i+1}] {$book.title|upper} by {$book.author}
            {if $book.price}                                
               Price: <span style="color:red">${$book.price}</span >
            {/if}                                          
      </div >
{foreachelse}
    No books {/foreach}

   Total: {$book@total}
</script>
<script type="text/javascript">
  var data = {
    greeting: 'Hi, there are some JScript books you may find interesting:',
    books: [{
      title: 'JavaScript: The Definitive Guide',
      author: 'David Flanagan',
      price: '31.18'
    }, {
      title: 'Murach JavaScript and DOM Scripting',
      author: 'Ray Harris'
    }, {
      title: 'Head First JavaScript',
      author: 'Michael Morrison',
      price: '29.54'
    }]
  };
</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
test 1
var tpl = new jSmart(document.getElementById('test_tpl').innerHTML);

document.write(tpl.fetch(data));
pending…
test 2
var tpl = new jSmart(document.getElementById('test_tpl').innerHTML);

document.write(tpl.fetch(data) + tpl.fetch(data));
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment