Skip to content

Commit 7fa2bf3

Browse files
committed
improve cell methods inlining and try to use monomorphic calls
1 parent 0f77206 commit 7fa2bf3

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

src/java/org/apache/cassandra/db/rows/AbstractCell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public boolean isCounterCell()
5555

5656
public boolean isLive(long nowInSec)
5757
{
58-
return localDeletionTime() == NO_DELETION_TIME || (ttl() != NO_TTL && nowInSec < localDeletionTime());
58+
return isLive(nowInSec, localDeletionTime(), ttl());
5959
}
6060

6161
public boolean isTombstone()

src/java/org/apache/cassandra/db/rows/Cell.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ public long localDeletionTime()
177177
*/
178178
public abstract boolean isLive(long nowInSec);
179179

180+
public final boolean isLive(long nowInSec, long localDeletionTime, int ttl)
181+
{
182+
return localDeletionTime == NO_DELETION_TIME || ttl != NO_TTL && nowInSec < localDeletionTime;
183+
}
184+
180185
/**
181186
* For cells belonging to complex types (non-frozen collection and UDT), the
182187
* path to the cell.

src/java/org/apache/cassandra/io/sstable/metadata/MetadataCollector.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.apache.cassandra.db.commitlog.CommitLogPosition;
3838
import org.apache.cassandra.db.commitlog.IntervalSet;
3939
import org.apache.cassandra.db.partitions.PartitionStatisticsCollector;
40+
import org.apache.cassandra.db.rows.ArrayCell;
4041
import org.apache.cassandra.db.rows.Cell;
4142
import org.apache.cassandra.db.rows.Unfiltered;
4243
import org.apache.cassandra.io.sstable.SSTable;
@@ -229,10 +230,27 @@ public void update(LivenessInfo newInfo)
229230
public void update(Cell<?> cell)
230231
{
231232
++currentPartitionCells;
232-
updateTimestamp(cell.timestamp());
233-
updateTTL(cell.ttl());
234-
updateLocalDeletionTime(cell.localDeletionTime());
235-
if (!cell.isLive(nowInSec))
233+
long timestamp;
234+
int ttl;
235+
long localDeletionTime;
236+
if (cell.getClass() == ArrayCell.class)
237+
{
238+
timestamp = cell.timestamp();
239+
ttl = cell.ttl();
240+
localDeletionTime = cell.localDeletionTime();
241+
}
242+
else
243+
{
244+
timestamp = cell.timestamp();
245+
ttl = cell.ttl();
246+
localDeletionTime = cell.localDeletionTime();
247+
}
248+
updateTimestamp(timestamp);
249+
updateTTL(ttl);
250+
updateLocalDeletionTime(localDeletionTime);
251+
252+
// isLive(nowInSec) is not used to avoid additional non-monomorphic calls of Cell methods
253+
if (!cell.isLive(nowInSec, localDeletionTime, ttl))
236254
updateTombstoneCount();
237255
}
238256

0 commit comments

Comments
 (0)