Sha256: 78fa0c6828efca2f6d12d48f26c1489ab111299db632e0d012370683687b3608
Contents?: true
Size: 461 Bytes
Versions: 29
Compression:
Stored size: 461 Bytes
Contents
require 'benchmark/ips' class A end class B def self.do end end class C def self.do end end Benchmark.ips do |x| x.report("responds_to? (nothing)") do |times| while (times -= 1) >= 0 A.do if A.respond_to?(:do) end end x.report("B (empty method)") do |times| while (times -= 1) >= 0 B.do end end x.report("responds_to? (empty method)") do |times| while (times -= 1) >= 0 C.do if C.respond_to?(:do) end end x.compare! end
Version data entries
29 entries across 29 versions & 1 rubygems