Skip to content

Commit

Permalink
Fix benchmark suite run
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed May 11, 2015
1 parent 14ebf61 commit 8fe4704
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ build/

actual.txt
test.txt
test/progit
test/benchinput.md
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ task :test => %w[test:unit]

desc 'Run benchmarks'
task :benchmark => :compile do |t|
if ENV['FETCH_PROGIT']
`rm -rf test/progit`
`git clone https://github.com/progit/progit.git test/progit`
langs = %w(ar az be ca cs de en eo es es-ni fa fi fr hi hu id it ja ko mk nl no-nb pl pt-br ro ru sr th tr uk vi zh zh-tw)
langs.each do |lang|
`cat test/progit/#{lang}/*/*.markdown >> test/benchinput.md`
end
end
$:.unshift 'lib'
load 'test/benchmark.rb'
end
Expand Down
10 changes: 5 additions & 5 deletions test/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ def dobench(name, &blk)
puts Benchmark.measure(&blk)
end

benchinput = File.open('../CommonMark/bench/benchinput.md', 'r').read()
benchinput = File.open('test/benchinput.md', 'r').read()

printf('input size = %d bytes\n\n', benchinput.bytesize)
printf("input size = %d bytes\n\n", benchinput.bytesize)

dobench('commonmarker with to_html') do
CommonMarker::Node.parse_string(benchinput).to_html
end

dobench('commonmarker with ruby HtmlRenderer') do
CommonMarker::HtmlRenderer.new.render(CommonMarker::Node.parse_string(benchinput))
end
# dobench('commonmarker with ruby HtmlRenderer') do
# CommonMarker::HtmlRenderer.new.render(CommonMarker::Node.parse_string(benchinput))
# end

dobench('redcarpet') do
Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: false, tables: false).render(benchinput)
Expand Down

0 comments on commit 8fe4704

Please sign in to comment.