require 'benchmark' module Gamer def foo end end class Pesho def foo end end class Gosho end class Maria include Gamer end Rails.logger.level = 1 n = 100000 Benchmark.bm do |x| x.report("without extend") do n.times do Pesho.new.foo end end x.report("with extend") do n.times do Gosho.new.extend(Gamer).foo end end x.report("with extend") do n.times do Maria.new.foo end end end
© 2024 Gudasoft
Theme by Anders Norén — Up ↑