Skip to content

Headers parsing performance optimization #366

Merged
merged 1 commit into from Nov 17, 2012

2 participants

@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
Owner
mikel commented Nov 17, 2012

Nice, thanks :)

@mikel mikel merged commit bced96d into mikel:master Nov 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.