Sha256: 286adff3de922d61219c774f79cc676e079a355939c63179010ff7ab0b8be5c4
Contents?: true
Size: 492 Bytes
Versions: 13
Compression:
Stored size: 492 Bytes
Contents
# frozen_string_literal: true 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
13 entries across 13 versions & 1 rubygems