Sha256: 2d17727b002d24f8578615acdd49e01463dda4ba6a265dcf33447de7e7939edb

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

#!/usr/bin/env ruby
require 'mastalk'
require 'ruby-prof'
require 'benchmark'

class MastalkBenchmark
  def initialize(documents:)
    @documents_size = documents
    @cms_page_content = File.read(File.join('spec', 'fixtures', 'cms_page_content'))
  end

  def to_html
    @documents_size.times do
      Mastalk::Document.new(@cms_page_content).to_html
    end
  end
end

Benchmark.bm do |x|
  x.report('Parsing 10 documents') do
    MastalkBenchmark.new(documents: 10).to_html
  end

  x.report('Parsing 100 documents') do
    MastalkBenchmark.new(documents: 100).to_html
  end

  x.report('Parsing 200 documents') do
    MastalkBenchmark.new(documents: 200).to_html
  end

  x.report('Parsing 500 documents') do
    MastalkBenchmark.new(documents: 500).to_html
  end

  x.report('Parsing 1000 documents') do
    MastalkBenchmark.new(documents: 1000).to_html
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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