Actions
Bug #13418
closedImprove Time#to_i performance
Description
Actions
Like0
Like0
Added by watson1978 (Shizuo Fujita) about 8 years ago. Updated about 8 years ago.
Description
Applied in changeset trunk|r58308.
time.c: Improve Time#to_i performance
Time#to_i will be faster around 80% (on 64-bit platforms).
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
From: Watson watson1978@gmail.com