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

MIME4J-283 DecoderUtil performance fix #26

Closed
wants to merge 1 commit into from

Conversation

hirthwork
Copy link

DecoderUtil currently uses the following regex pattern for rfc2047-encoded words: 
"(.*?)=\\?(.+?)\\?(\\w)\\?(.*?)\\?="
First capturing group (.*?) is a very expensive regular expression causing next pattern node evaluation on every input character. Because of this decoding of 4 KB input (To: field with 40-80 recipients) takes up to 200ms on modern CPUs.

At the same time, this capturing group used only to store separator text between encoded words. Proposed patch reuses existing tailIndex for separator text extraction and same input decoding now takes only 1-2ms.

Copy link
Contributor

@chibenwa chibenwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this great contribution that unlocks significant performance improvement.

Let's wait a couple other approuvals before merging.

Cheers,

Benoit Tellier

@hirthwork
Copy link
Author

Bump.
Any chance to have this merged? I've prefer to use mime4j version from master instead of locally patched version

@chibenwa
Copy link
Contributor

I am going to merge it now

@chibenwa
Copy link
Contributor

Hi,

This pull request has just been merged.

Thank you again for your dedication toward the James project.

One very last thing: I don't have write access to this repository, hence I can not close this issue. Wouldn't you mind doing it for me? It would avoid me annoying the Apache INFRA team with such simple concerns.

Thanks again,

Cheers,

Benoit

@hirthwork hirthwork closed this Jan 24, 2019
@chibenwa chibenwa reopened this May 25, 2021
@chibenwa chibenwa closed this May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants