Sha256: 670d22ad084a76d8d8d9e5823d720e317788858e510a0f02bcb8312222205499

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

#!/usr/bin/env ruby
require 'bundler/setup'
Bundler.require(:profile)

%w(benchmark kramdown bluecloth rdiscount).each do |lib|
  require lib
end

require 'mastalk'

n  = 1000
mastalk = Mastalk::Document.new(File.read(File.join('spec', 'fixtures', 'cms_page_content')))
markdown = mastalk.send(:preprocess, mastalk.source)

def parse_markdown(parser, markdown)
  parser.new(markdown).to_html
end

Benchmark.bm 15 do |x|
  x.report('Kramdown') do
    n.times { parse_markdown Kramdown::Document, markdown }
  end

  x.report('Bluecloth') do
    n.times { parse_markdown BlueCloth, markdown }
  end

  x.report('RDiscount') do
    n.times { parse_markdown RDiscount, markdown }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mastalk-0.9.1 bin/markdown-libraries-benchmark
mastalk-0.9.0 bin/markdown-libraries-benchmark