Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (60 sloc) 1.902 kb
<!DOCTYPE html>
<title>Transparency perf test</title>
<script src="lib/benchmark.js"></script>
<script src="lib/weld.js"></script>
<script src="lib/handlebars-1.0.0.beta.6.js"></script>
<script src="lib/jquery-1.7.1.min.js"></script>
<script src="lib/coffee-script.js"></script>
<script src="../lib/transparency.js"></script>
<pre id="results"></pre>
<div id="transparency">
<div class="title"></div>
<div class="children">
<span class="item"></span>
<div id="handlebars">
<script id="handlebars-template" type="text/handlebars">
{{#each foobar}}
<span class='item'>{{this}}</span>
<script type="text/coffeescript">
children = ['10000000', '2', '3', '4', '5', '6', '7', '8', '9', '10']
sharedVariables = (title: "AFASDF", children: children for n in [1..100])
# For handlebars
foobar = foobar: sharedVariables
results = $("#results")
transparencyTemplate = $("#transparency")[0]
handlebarsOutput = $("#handlebars")[0]
handlebarsTemplate = Handlebars.compile($("#handlebars-template").text())
Transparency.render transparencyTemplate, sharedVariables
handlebarsOutput.innerHTML = handlebarsTemplate foobar
new Benchmark.Suite()
.add("transparency", ->
Transparency.render transparencyTemplate, sharedVariables, children: item: text: -> @value)
.add("handlebars", ->
handlebarsOutput.innerHTML = handlebarsTemplate foobar)
.on("cycle", (event, bench) ->
console.log String(bench)
results.append String(bench) + '\n')
.on("complete", ->
results.append "Fastest is " + @filter("fastest").pluck("name"))
.run true
Jump to Line
Something went wrong with that request. Please try again.