Benoit Tellier created JAMES-3883:
-------------------------------------

             Summary: About MimeTokenStream usage of LinkedList
                 Key: JAMES-3883
                 URL: https://issues.apache.org/jira/browse/JAMES-3883
             Project: James Server
          Issue Type: Improvement
            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)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to