Sha256: 3f9cbbe9cdb195ffbfea4c4de2dda1903af6fd629671b8c3fd560741d78ca8ae

Contents?: true

Size: 596 Bytes

Versions: 8

Compression:

Stored size: 596 Bytes

Contents

prelude: |
  require 'erb'

  template = <<EOS
  <html>
    <head> <%= title %> </head>
    <body>
      <h1> <%= title %> </h1>
      <p>
        <%= content %>
      </p>
    </body>
  </html>
  EOS

  title = "hello world!"
  content = "hello world!\n" * 10

benchmarks:
  - name: ERB compiling
    benchmark: ERB.new(template)
    loop_count: 10000

  - name: ERB rendering
    prelude: |
      src = "def self.render(title, content); #{ERB.new(template).src}; end"
      mod = Module.new
      mod.instance_eval(src, "(ERB)")
    benchmark: mod.render(title, content)
    loop_count: 100000

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
benchkit-0.2.1 ruby_benchmark_set/lib/erb.yml
benchmark_driver-0.3.0 benchmarks/lib/erb.yml
benchmark_driver-0.2.4 benchmarks/lib/erb.yml
benchmark_driver-0.2.3 benchmarks/lib/erb.yml
benchmark_driver-0.2.2 benchmarks/lib/erb.yml
benchmark_driver-0.2.1 benchmarks/lib/erb.yml
benchkit-0.2.0 ruby_benchmark_set/lib/erb.yml
benchmark_driver-0.2.0 ruby_benchmark_set/lib/erb.yml