Sha256: 6a8a09f4f0874b6785ccb54abff17db8e94f64d00d82e7c54720b356c40fda2f

Contents?: true

Size: 401 Bytes

Versions: 8

Compression:

Stored size: 401 Bytes

Contents

Benchmark.ips do |x|
  %x{
    var o = {}
    o[Symbol.for('foo')] = 123
    o.foo = 123
    var foo = Symbol('foo')
    o[foo] = 123
    var a = 0, b = 0, c = 0
  }

  x.report('global symbol') do
    `a += o[Symbol.for('foo')]`
  end

  x.report('symbol') do
    `a += o[foo]`
  end

  x.report('ident') do
    `b += o.foo`
  end

  x.report('string') do
    `c += o['foo']`
  end

  x.compare!
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
opal-1.1.0.rc1 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.5 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.4 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.3 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.2 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.1 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.0 benchmark-ips/bm_js_symbols_vs_strings.rb
opal-1.0.0.beta1 benchmark-ips/bm_js_symbols_vs_strings.rb