Sha256: dbf8b114ada1ce136c0805cef0e2272ef012378f414e3a38915214c150ba0a4e

Contents?: true

Size: 824 Bytes

Versions: 4

Compression:

Stored size: 824 Bytes

Contents

require 'commonmarker'
require 'github/markdown'
require 'redcarpet'
require 'kramdown'
require 'benchmark'

def dobench(name, &blk)
  puts name
  puts Benchmark.measure(&blk)
end

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

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

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

dobench('github-markdown') do
  GitHub::Markdown.render(benchinput)
end

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('kramdown') do
  Kramdown::Document.new(benchinput).to_html(benchinput)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
commonmarker-0.1.3 test/benchmark.rb
commonmarker-0.1.2 test/benchmark.rb
commonmarker-0.1.1 test/benchmark.rb
commonmarker-0.1.0 test/benchmark.rb