Created
May 23, 2010 09:18
-
-
Save judofyr/410786 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ JIT=true CACHED=true ruby -rubygems benchmarks/speed.rb | |
user system total real | |
ERB w/ caching 0.180000 0.000000 0.180000 ( 0.183660) | |
HAML w/ caching 0.790000 0.010000 0.800000 ( 0.799260) | |
{{ w/ caching 0.370000 0.010000 0.380000 ( 0.381047) | |
$ CACHED=true ruby -rubygems benchmarks/speed.rb | |
user system total real | |
ERB w/ caching 0.180000 0.000000 0.180000 ( 0.182621) | |
HAML w/ caching 0.780000 0.010000 0.790000 ( 0.793207) | |
{{ w/ caching 0.790000 0.000000 0.790000 ( 0.790434) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code generated by Handlebars | |
"<h1>#{CGI.escapeHTML(ctx.mustache.header.to_s)}</h1>\n#{if ctx.mustache.list; "<ul>\n #{ ctx.mustache.item.map do |__handlebars_12| | |
begin | |
ctx.push(:item, __handlebars_12) | |
"#{if __handlebars_12[:current]; "<li><strong>#{CGI.escapeHTML(__handlebars_12[:name].to_s)}</strong></li>\n "; end}#{if ctx.mustache.link; "<li><a href=\"#{CGI.escapeHTML(__handlebars_12[:url].to_s)}\">#{CGI.escapeHTML(__handlebars_12[:name].to_s)}</a></li>\n "; end}" | |
ensure | |
ctx.pop | |
end | |
end.join | |
}</ul>\n"; end}#{if !ctx.mustache.list; "<p>The list is empty.</p>\n"; end}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code generated by Mustache | |
"<h1>#{CGI.escapeHTML(ctx[:header].to_s)}</h1>\n#{ if v = ctx[:list] | |
if v == true | |
"<ul>\n #{ if v = ctx[:item] | |
if v == true | |
"#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}" | |
elsif v.is_a?(Proc) | |
v.call("#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}"; ctx.pop; r }.join | |
end | |
end | |
}</ul>\n" | |
elsif v.is_a?(Proc) | |
v.call("<ul>\n #{ if v = ctx[:item] | |
if v == true | |
"#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}" | |
elsif v.is_a?(Proc) | |
v.call("#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}"; ctx.pop; r }.join | |
end | |
end | |
}</ul>\n") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<ul>\n #{ if v = ctx[:item] | |
if v == true | |
"#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}" | |
elsif v.is_a?(Proc) | |
v.call("#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "#{ if v = ctx[:current] | |
if v == true | |
"<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><strong>#{CGI.escapeHTML(ctx[:name].to_s)}</strong></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}#{ if v = ctx[:link] | |
if v == true | |
"<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n " | |
elsif v.is_a?(Proc) | |
v.call("<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n ") | |
else | |
v = [v] unless v.is_a?(Array) # shortcut when passed non-array | |
v.map { |h| ctx.push(h); r = "<li><a href=\"#{CGI.escapeHTML(ctx[:url].to_s)}\">#{CGI.escapeHTML(ctx[:name].to_s)}</a></li>\n "; ctx.pop; r }.join | |
end | |
end | |
}"; ctx.pop; r }.join | |
end | |
end | |
}</ul>\n"; ctx.pop; r }.join | |
end | |
end | |
}#{ v = ctx[:list] | |
if v.nil? || v == false || v.respond_to?(:empty?) && v.empty? | |
"<p>The list is empty.</p>\n" | |
end | |
}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment