Sha256: 432198a12c70e9f4fb9bc8f846eb6d7ffb6603aa0dc12e7e9be6cf9f437edefa

Contents?: true

Size: 738 Bytes

Versions: 16

Compression:

Stored size: 738 Bytes

Contents

require 'benchmark'

n = 10_000

class  Foo; end
module Bar; end


Benchmark.benchmark do |bm|
  puts "Class.new(Foo)"

  3.times do
    bm.report do
      n.times do
        Class.new(Foo)
      end
    end
  end

  puts "Class.new { include Bar }"

  3.times do
    bm.report do
      n.times do
        Class.new { include Bar }
      end
    end
  end
end

# $ ruby benchmarks/include_v_superclass.rb
# Class.new(Foo)
#   0.030000   0.000000   0.030000 (  0.033536)
#   0.020000   0.000000   0.020000 (  0.022077)
#   0.040000   0.010000   0.050000 (  0.035813)
# Class.new { include Bar }
#   0.040000   0.000000   0.040000 (  0.041427)
#   0.040000   0.000000   0.040000 (  0.039019)
#   0.030000   0.000000   0.030000 (  0.037018)

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
opal-rspec-0.8.0 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.8.0.alpha3 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.8.0.alpha2 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.8.0.alpha1 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.7.1 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.7.0 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.6.2 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.7.0.rc.2 rspec-expectations/upstream/benchmarks/include_v_superclass.rb
opal-rspec-0.6.1 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.6.0 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.6.0.beta1 rspec-expectations/benchmarks/include_v_superclass.rb
opal-connect-rspec-0.5.0 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.5.0 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.5.0.beta3 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.5.0.beta2 rspec-expectations/benchmarks/include_v_superclass.rb
opal-rspec-0.5.0.beta1 rspec-expectations/benchmarks/include_v_superclass.rb