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

Memoize the result of CSV#encode_re #157

Merged
merged 1 commit into from
Oct 8, 2015
Merged

Memoize the result of CSV#encode_re #157

merged 1 commit into from
Oct 8, 2015

Conversation

jpmckinney
Copy link

stack

Calling CSV.new twice for each line of a CSV is expensive, and the slowest part of that is calling encode_re on the same string thousands of times (this is the biggest bottleneck). This patch memoizes return values and produces the following graph:

stack

@jpmckinney jpmckinney mentioned this pull request Oct 7, 2015
@pezholio pezholio merged commit 51c7db6 into Data-Liberation-Front:master Oct 8, 2015
pezholio added a commit that referenced this pull request Oct 8, 2015
@jpmckinney jpmckinney deleted the opt branch October 8, 2015 14:44
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.

2 participants