netudima commented on code in PR #3761:
URL: https://github.com/apache/cassandra/pull/3761#discussion_r1901165468
##########
src/java/org/apache/cassandra/io/sstable/format/SortedTableWriter.java:
##########
@@ -270,22 +271,29 @@ protected void onStaticRow(Row row)
protected void onRow(Row row)
{
- notifyObservers(o -> o.nextUnfilteredCluster(row));
+ if (hasObservers())
+ notifyObservers(o -> o.nextUnfilteredCluster(row));
}
protected void onRangeTombstoneMarker(RangeTombstoneMarker marker)
{
- notifyObservers(o -> o.nextUnfilteredCluster(marker));
+ if (hasObservers())
+ notifyObservers(o -> o.nextUnfilteredCluster(marker));
}
protected abstract AbstractRowIndexEntry createRowIndexEntry(DecoratedKey
key, DeletionTime partitionLevelDeletion, long finishResult) throws IOException;
protected final void notifyObservers(Consumer<SSTableFlushObserver> action)
{
- if (observers != null && !observers.isEmpty())
+ if (hasObservers())
observers.forEach(action);
}
+ private boolean hasObservers()
Review Comment:
of course, it is not a big saving by itself, but small amounts here and
there can add up to something substantial overall.
--
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]