Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Make sure require_tzinfo only calls Kernel#require if TZInfo isn't al…

…ready present.

This wasn't a problem when require_tzinfo was only called from TimeZone#initialize, but now it's being called for every lookup to TimeZone.[] (via lazy_zones_map)

TimeZone lookup can occur when unmarshalling TimeWithZone objects, which is where I first saw the big slowdown (500ms for each Rails action that loaded from Rails.cache)
  • Loading branch information...
1 parent 2b354fe commit 2147f35df251f215d845e870f21fd4010976eba3 @toolmantim toolmantim committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  activesupport/lib/active_support/values/time_zone.rb
2  activesupport/lib/active_support/values/time_zone.rb
@@ -371,7 +371,7 @@ def us_zones
def require_tzinfo
- require 'tzinfo'
+ require 'tzinfo' unless defined?(::TZInfo)
rescue LoadError
$stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install"

0 comments on commit 2147f35

Please sign in to comment.
Something went wrong with that request. Please try again.