[ 
https://issues.apache.org/jira/browse/CASSANDRA-21199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082993#comment-18082993
 ] 

Matt Byrd commented on CASSANDRA-21199:
---------------------------------------

Have added the mentioned property check before 
Guardrails.readConsistencyLevels.guard similarly to the 
Guardrails.writeConsistencyLevels.guard you added previously.
Also found some other things, I don't have supporting allocation traces for 
them, but there is:
1. An array copy within MerkleTree.xor 
2. use of stream().anyMatch within mutateAtomically

I think possibly 2. might possibly in practice be fine, and somehow be 
optimised away, maybe scalarized via escape analysis and end up ok, but seems 
just more straightforward to reason about to replace with a for loop.
https://github.com/apache/cassandra/pull/4838

am running CI also and will attach.

There was also IndeOffsets where we seem to grow an array by 10 at a time, so 
O(N^2) but possibly this is generally fine, since offsets I think by default 
are every 64kb.
Still this might warrant looking into separately, may file a separate jira for 
that to just grow that array exponentially, maybe 1.5X or something instead.

> ProtocolVersion::supportedVersions can be computed once to avoid showing up 
> in allocation profiles
> --------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-21199
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21199
>             Project: Apache Cassandra
>          Issue Type: Improvement
>            Reporter: Matt Byrd
>            Assignee: Matt Byrd
>            Priority: Normal
>         Attachments: Screenshot 2026-03-04 at 7.01.51 PM.png
>
>
> It's a relatively small amount in one allocation profile (see attached 
> screenshot) ~0.3% of allocations, but still seems un-necessary as we're 
> copying elements from a static final EnumSet
> {code}
>     /** All supported versions, published as an enumset */
>     public final static EnumSet<ProtocolVersion> SUPPORTED = 
> EnumSet.copyOf(Arrays.asList(ArrayUtils.addAll(SUPPORTED_VERSIONS)));
> {code}
> Could instead just compute this in static initialization .
> {code}
>     public static List<String> supportedVersions()
>     {
>         List<String> ret = new ArrayList<>(SUPPORTED.size());
>         for (ProtocolVersion version : SUPPORTED)
>             ret.add(version.toString());
>         return ret;
>     }
> {code}



--
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