[
https://issues.apache.org/jira/browse/MIME4J-302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benoit Tellier updated MIME4J-302:
----------------------------------
Attachment: mime4j-302-after.png
mime4j-302-before.png
> MessageBuilder::parse repeatedly calls toLowerCase on header names
> ------------------------------------------------------------------
>
> Key: MIME4J-302
> URL: https://issues.apache.org/jira/browse/MIME4J-302
> Project: James Mime4j
> Issue Type: Improvement
> Components: core, dom
> Reporter: Benoit Tellier
> Priority: Major
> Labels: perf
> Attachments: mime4j-302-after.png, mime4j-302-before.png
>
>
> As attached I was surprised MIME4J parsing spends 18% of its time calling
> toLowerCase on header names. This represents 12% of allocated memory.
> By holding the lowerCased name as part of the field name, and doing lazy
> initialization on it we can get this down to 6%.
> Also, an optimization implemented in MaximalBodyDescriptor aims at reducing
> the costs of toLowerCase calls: upon known header names lookup the lowercase
> version of the field instead of the normal version to benefit optimizations
> (calling toLowerCase on a lowerCase string do not do allocation, it just
> iterates String content). It might be worth generalizing it.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)