Sha256: f2acb8730cb83c22c19f2c7154449b2332bff3bde802fd69b5faa41d349f218e

Contents?: true

Size: 944 Bytes

Versions: 10

Compression:

Stored size: 944 Bytes

Contents

require 'bundler/setup'
require 'flipper'
require 'benchmark/ips'

Benchmark.ips do |x|
  x.report("Typecast.to_boolean true") { Flipper::Typecast.to_boolean(true) }
  x.report("Typecast.to_boolean 1") { Flipper::Typecast.to_boolean(1) }
  x.report("Typecast.to_boolean 'true'") { Flipper::Typecast.to_boolean('true'.freeze) }
  x.report("Typecast.to_boolean '1'") { Flipper::Typecast.to_boolean('1'.freeze) }
  x.report("Typecast.to_boolean false") { Flipper::Typecast.to_boolean(false) }

  x.report("Typecast.to_integer 1") { Flipper::Typecast.to_integer(1) }
  x.report("Typecast.to_integer '1'") { Flipper::Typecast.to_integer('1') }

  x.report("Typecast.to_float 1") { Flipper::Typecast.to_float(1) }
  x.report("Typecast.to_float '1'") { Flipper::Typecast.to_float('1'.freeze) }
  x.report("Typecast.to_float 1.01") { Flipper::Typecast.to_float(1) }
  x.report("Typecast.to_float '1.01'") { Flipper::Typecast.to_float('1'.freeze) }
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.0.0 benchmark/typecast_ips.rb
flipper-1.0.0.pre benchmark/typecast_ips.rb
flipper-0.28.3 benchmark/typecast_ips.rb
flipper-0.28.2 benchmark/typecast_ips.rb
flipper-0.28.1 benchmark/typecast_ips.rb
flipper-0.28.0 benchmark/typecast_ips.rb
flipper-0.27.1 benchmark/typecast_ips.rb
flipper-0.27.0 benchmark/typecast_ips.rb
flipper-0.26.2 benchmark/typecast_ips.rb
flipper-0.26.1 benchmark/typecast_ips.rb