Sha256: f8a9ebccf64ab3fcbf3060a24b36d83ef4eef9f442f641be5f4ac33bb1ae1c36

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true
require 'rubygems'
require 'erubis'
require 'erubis/tiny'
require 'erb'
require "benchmark"
require File.join(File.dirname(__FILE__), '..', 'lib', 'yard')

def rungen
  YARD::Registry.load_yardoc(File.join(File.dirname(__FILE__), '..', '.yardoc'))
  YARD::Registry.at("YARD::CodeObjects::Base").format(:format => :html)
end

Benchmark.bmbm do |x|
  x.report("erubis") do
    eval <<-eof
      module YARD; module Templates; module Template
        def erb_with(str, x) Erubis::Eruby.new(str) end
      end end end
    eof

    rungen
  end

  x.report("fast-erubis") do
    eval <<-eof
      module YARD; module Templates; module Template
        def erb_with(str, x) Erubis::FastEruby.new(str) end
      end end end
    eof

    rungen
  end

  x.report("tiny-erubis") do
    eval <<-eof
      module YARD; module Templates; module Template
        def erb_with(str, x) Erubis::TinyEruby.new(str) end
      end end end
    eof

    rungen
  end

  x.report("erb") do
    eval <<-eof
       module YARD; module Templates; module Template
        def erb_with(str, x) ERB.new(str, nil) end
      end end end
    eof

    rungen
  end
end

Version data entries

11 entries across 10 versions & 4 rubygems

Version Path
yard-0.9.12 benchmarks/erb_vs_erubis.rb
yard-0.9.11 benchmarks/erb_vs_erubis.rb
yard-0.9.10 benchmarks/erb_vs_erubis.rb
yard-0.9.9 benchmarks/erb_vs_erubis.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/benchmarks/erb_vs_erubis.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/benchmarks/erb_vs_erubis.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/benchmarks/erb_vs_erubis.rb
yard-0.9.8 benchmarks/erb_vs_erubis.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/benchmarks/erb_vs_erubis.rb
yard-0.9.7 benchmarks/erb_vs_erubis.rb
yard-0.9.6 benchmarks/erb_vs_erubis.rb