[ https://issues.apache.org/jira/browse/MIME4J-323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benoit Tellier updated MIME4J-323: ---------------------------------- Attachment: Screenshot from 2023-02-13 16-45-40.png > 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 > Priority: Major > Attachments: Screenshot from 2023-02-13 16-45-40.png > > > 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)