Sha256: 552867c75aa6231b8ece987e0eec8ed7660cc63646ec7e56b8c7f42e5e4a037d
Contents?: true
Size: 1.39 KB
Versions: 10
Compression:
Stored size: 1.39 KB
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) } x.report("Typecast.to_number 1") { Flipper::Typecast.to_number(1) } x.report("Typecast.to_number 1.1") { Flipper::Typecast.to_number(1.1) } x.report("Typecast.to_number '1'") { Flipper::Typecast.to_number('1'.freeze) } x.report("Typecast.to_number '1.1'") { Flipper::Typecast.to_number('1.1'.freeze) } x.report("Typecast.to_number nil") { Flipper::Typecast.to_number(nil) } time = Time.now x.report("Typecast.to_number Time.now") { Flipper::Typecast.to_number(time) } end
Version data entries
10 entries across 10 versions & 1 rubygems