Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Headers parsing performance optimization #366

Merged
merged 1 commit into from
Nov 17, 2012
Merged

Headers parsing performance optimization #366

merged 1 commit into from
Nov 17, 2012

Conversation

bogdan
Copy link
Contributor

@bogdan bogdan commented Mar 6, 2012

Among other tiny changes this PR contains the following optimization:

-        selected = select_field_for(field.name)
-
-        if selected.any? && limited_field?(field.name) 
+        if limited_field?(field.name) && (selected = select_field_for(field.name)) && selected.any?

This allows select_field_for(that is pretty slow when number of headers is high) be called only when limited_field? returns true.

About 30% performance improvement for Mail::Header.new method when there are a lot of unknown headers.

@mikel
Copy link
Owner

mikel commented Nov 17, 2012

Nice, thanks :)

@mikel mikel merged commit bced96d into mikel:master Nov 17, 2012
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants