You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Benoit Tellier (Jira)" <mi...@james.apache.org> on 2023/02/13 09:53:00 UTC
[jira] [Created] (MIME4J-323) About MimeTokenStream usage of LinkedList
Benoit Tellier created MIME4J-323:
-------------------------------------
Summary: About MimeTokenStream usage of LinkedList
Key: MIME4J-323
URL: https://issues.apache.org/jira/browse/MIME4J-323
Project: James Mime4j
Issue Type: Improvement
Components: core
Reporter: Benoit Tellier
A defacto programming MOJO around is that linked list is bad: overhead of allocating bi-directional pointers, bad cache locality, etc... The benefits are low compared to precised arrays that are a better de-facto choice.
Now see attached a flame graph from James showing 2% of its allocation, and 18.7 of memory allocations of that parsing use case. See attached flame graph.
I benchmarked ArrayDeque usage locally and it was shlightly faster (in the ms range) and allocated ~1KB less per message:
{code:java}
BEFORE
JMHLongMultipartReadBench.benchmark1 avgt 5 39.842 ± 1.820 us/op
JMHLongMultipartReadBench.benchmark1:·gc.alloc.rate.norm avgt 5 19448.003 ± 0.001 B/op
AFTER
JMHLongMultipartReadBench.benchmark1 avgt 5 38.687 ± 2.935 us/op
JMHLongMultipartReadBench.benchmark1:·gc.alloc.rate.norm avgt 5 18128.003 ± 0.001 B/op
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)