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