1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Benchmark stuff.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@24 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
hcatlin 2006-08-21 03:33:30 +00:00
parent 67a81207f7
commit 26360e28d3
2 changed files with 41 additions and 0 deletions

17
test/benchmark.rb Normal file
View file

@ -0,0 +1,17 @@
require File.dirname(__FILE__) + '/../lib/haml/engine'
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'rubygems'
require 'action_view'
include HAMLHelpers
#require 'benchmark'
ActionView::Base.register_template_handler("haml", HAML::Engine)
@base = ActionView::Base.new(File.dirname(__FILE__))
RUNS = 2
Benchmark.bm do |x|
x.report("haml: ") { RUNS.times { @base.render("templates/standard"); } }
x.report("rhtml:") { RUNS.times { @base.render( "rhtml/standard"); } }
end

24
test/rhtml/standard.rhtml Normal file
View file

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml-lang='en-US'>
<head>
<title><%= "Hampton Catlin Is Totally Awesome" %></title>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
</head>
<body>
<!-- You're In my house now! -->
<div class='header'>
Yes, ladies and gentileman. He is just that egotistical.
Fantastic! This should be multi-line output
The question is if this would translate! Ahah!
<%= 1 + 9 + 8 + 2 %>
</div>
<div id='body'><%= " Quotes should be loved! Just like people!" %></div>
<div class='of_divs_with_underscore' id='combo'><%= @should_eval = "with this text" %></div>
<div class='footer'>
<strong class='shout'>
<%= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid.\n" +
" So, I'm just making it *really* long. God, I hope this works" %>
</strong>
</div>
</body>
</html>