From: watson1978@... Date: 2017-04-10T09:41:19+00:00 Subject: [ruby-core:80636] [Ruby trunk Bug#13418] Improve Time#to_i performance Issue #13418 has been reported by watson1978 (Shizuo Fujita). ---------------------------------------- Bug #13418: Improve Time#to_i performance https://bugs.ruby-lang.org/issues/13418 * Author: watson1978 (Shizuo Fujita) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Time#to_i will be faster around 80%. ### Before ~~~ user system total real 2.840000 0.000000 2.840000 ( 2.847238) ~~~ ### After ~~~ user system total real 1.600000 0.000000 1.600000 ( 1.598911) ~~~ ### Test code ~~~ require 'benchmark' Benchmark.bmbm do |x| x.report do t = Time.now 20000000.times do t.to_i end end end ~~~ ### Patch https://github.com/ruby/ruby/pull/1576 -- https://bugs.ruby-lang.org/ Unsubscribe: