Sha256: a8be65854afae1bfd5d4b76142444dcf0aeffef94054fb35661c2c0bd11d418c

Contents?: true

Size: 417 Bytes

Versions: 8

Compression:

Stored size: 417 Bytes

Contents

require "benchmark"

TIMES = 10_000

module A
  Benchmark.bmbm do |x|
    x.report("eval")          { TIMES.times { eval("x = 2", binding) } }
    x.report("instance-eval") { TIMES.times { instance_eval "x = 2" } }
    x.report("module-eval")   { TIMES.times { module_eval "x = 2"} }
    x.report("class-eval")    { TIMES.times { class_eval "x = 2"} }
    x.report("non-eval")      { TIMES.times { x = 2 } }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tadpole-0.1.7 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.1 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.2 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.3 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.4 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.5 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.6 benchmarks/eval-vs-non-eval.rb
tadpole-0.1.0 benchmarks/eval-vs-non-eval.rb