belliottsmith commented on code in PR #1951:
URL: https://github.com/apache/cassandra/pull/1951#discussion_r1014235053
##########
src/java/org/apache/cassandra/service/accord/AccordObjectSizes.java:
##########
@@ -42,6 +52,27 @@ public static long key(Key key)
return ((AccordKey.PartitionKey) key).estimatedSizeOnHeap();
}
+ public static long key(RoutingKey key)
+ {
+ return ((AccordRoutingKey) key).estimatedSizeOnHeap();
+ }
+
+ private static final long EMPTY_KEY_RANGE_SIZE =
ObjectSizes.measure(TokenRange.fullRange(TableId.generate()));
+ public static long range(KeyRange range)
+ {
+ return EMPTY_KEY_RANGE_SIZE + key(range.start()) + key(range.end());
+ }
+
+ private static final long EMPTY_KEY_RANGES_SIZE =
ObjectSizes.measure(KeyRanges.of());
+ public static long ranges(KeyRanges ranges)
+ {
+ long size = EMPTY_KEY_RANGES_SIZE;
+ size += ObjectSizes.sizeOfReferenceArray(ranges.size());
+ for (int i = 0, mi = ranges.size() ; i < mi ; i++)
Review Comment:
Lots of room for optimisation of this kind of thing. I'll introduce a
dedicated TODO for this case, to remind us.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]