New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement TZInfo.eager_load! #129
Conversation
We recently instrumented our application to locate the source of the constant cache bumps we were seeing, and tzinfo came up as one of the sources. In production environment, it's detrimental for performance to use lazy loading. It's much better to load everything upfront as part of boot.
Which constant(s) are defined when loading a new timezone? |
If you use the "ruby datasource" it load the individual ruby definition file from And they all include module TimezoneDefinition #:nodoc:
# Adds class methods to the includee.
#
# @param base [Module] the includee.
def self.append_features(base)
super
base.extend(Format2::TimezoneDefinition::ClassMethods)
base.extend(ClassMethods)
end |
An alternative implementation to #129.
Thanks for submitting this. I've implemented something that will achieve the same thing in a slightly different way. Commit 94be919 adds a The implementation avoids the temporary creation of |
Thanks @philr, it however is infortunate it's not at least aliased as config.eager_load_namespaces << TZinfo |
I wasn't aware of that Rails convention. I've made a further change (c4f177c) to add a |
Thank you! That's very helpful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
We recently instrumented our application to locate the source of the constant cache bumps we were seeing, and tzinfo came up as one of the sources.
In production environment, it's detrimental for performance to use lazy loading. It's much better to load everything upfront as part of boot.