Created
July 17, 2018 01:56
-
-
Save okkez/e4547806106d969b98040e644d166d20 to your computer and use it in GitHub Desktop.
Benchmarking Fluent::Timezone.utc_offset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rehearsal ---------------------------------------------------------- | |
Asia/Tokyo 0.546691 0.111622 0.658313 ( 0.659132) | |
US/Pacific summer time 0.624673 0.144011 0.768684 ( 0.768710) | |
US/Pacific 0.628339 0.144027 0.772366 ( 0.772654) | |
------------------------------------------------- total: 2.199363sec | |
user system total real | |
Asia/Tokyo 0.526534 0.107934 0.634468 ( 0.634722) | |
US/Pacific summer time 0.561836 0.183536 0.745372 ( 0.745895) | |
US/Pacific 0.624210 0.124091 0.748301 ( 0.748303) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
require_relative "./lib/fluent/load" | |
require "time" | |
N = 100_000 | |
Benchmark.bmbm do |x| | |
x.report("Asia/Tokyo") do | |
time = Time.parse("2018-03-11 02:00:00 Asia/Tokyo") | |
N.times do | |
Fluent::Timezone.utc_offset(time, "Asia/Tokyo") | |
end | |
end | |
x.report("US/Pacific summer time") do | |
time = Time.parse("2018-03-12 02:00:00 US/Pacific") | |
N.times do | |
Fluent::Timezone.utc_offset(time, "US/Pacific") | |
end | |
end | |
x.report("US/Pacific") do | |
time = Time.parse("2018-03-11 02:00:00 US/Pacific") | |
N.times do | |
Fluent::Timezone.utc_offset(time, "US/Pacific") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment