[ 
https://issues.apache.org/jira/browse/CASSANDRA-20212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitry Konstantinov updated CASSANDRA-20212:
--------------------------------------------
    Change Category: Performance
         Complexity: Normal
        Component/s: Local/Memtable

> Avoid megamorpthic calls for NativeCell
> ---------------------------------------
>
>                 Key: CASSANDRA-20212
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20212
>             Project: Apache Cassandra
>          Issue Type: Improvement
>          Components: Local/Memtable
>            Reporter: Dmitry Konstantinov
>            Assignee: Dmitry Konstantinov
>            Priority: Normal
>         Attachments: image-2025-01-15-21-31-21-426.png
>
>
> If we use offheap_objects allocation mode we have 3 implementations of Cells 
> used at the same time:
>  * NativeCell
>  * BufferCell
>  * ArrayCell (CASSANDRA-15393)
> When all of them are invoked from the same callsite JIT compiler cannot 
> optimize such calls properly and we have megamorphic virtual calls with 
> correspondent overheads and lack of inlining. 
> The basic way to solve this issue is to reduce the number of Cell 
> implementations are actively used and invoked from the same callsites.
> CASSANDRA-20166 replaces BufferCell with ArrayCell 
> Other places to consider:
>  * SimpleBuilders logic
> !image-2025-01-15-21-31-21-426.png|width=300!
>  * EnsureOnHeap / HeapCloner used to clone data during reads
> for them probably we can also move to ArrayCell usage.
>  
> Related links:
>  * 
> [http://insightfullogic.com/2014/May/12/fast-and-megamorphic-what-influences-method-invoca/]
>  
>  * 
> [https://mechanical-sympathy.blogspot.com/2012/04/invoke-interface-optimisations.html]
>  
>  * [https://shipilev.net/blog/2015/black-magic-method-dispatch/]
>  * [https://shipilev.net/jvm/anatomy-quarks/16-megamorphic-virtual-calls/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to