Skip to content
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

Don't re-parse country codes YAML file every time it's needed. #111

Merged
merged 1 commit into from
Aug 19, 2015

Conversation

jcoleman
Copy link
Contributor

#109 added a country codes YAML file in order to remove the dependency on the countries gem. This is all well and good, but the current implementation reloads and re-parses that file every time the hash is needed. This potentially triggers reloading/parsing every time a phone number is normalized which adds a huge amount of unnecessary disk and CPU overhead to normalization.

This patches adds a simple cache for that hash.

joost pushed a commit that referenced this pull request Aug 19, 2015
Don't re-parse country codes YAML file every time it's needed.
@joost joost merged commit 05bf5eb into joost:master Aug 19, 2015
@joost
Copy link
Owner

joost commented Aug 19, 2015

This is in 0.12.10.

@jcoleman
Copy link
Contributor Author

Thanks!

@jcoleman jcoleman deleted the fix-constant-yaml-parsing branch August 19, 2015 13:05
@monfresh
Copy link
Contributor

Awesome. I've been meaning to do this. I realized I forgot to add that after I submitted the PR. Thanks for getting to it before me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants