You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Ariel Weisberg (Jira)" <ji...@apache.org> on 2022/10/31 20:46:00 UTC
[jira] [Commented] (CASSANDRA-15215) VIntCoding should read and write more efficiently
[ https://issues.apache.org/jira/browse/CASSANDRA-15215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626840#comment-17626840 ]
Ariel Weisberg commented on CASSANDRA-15215:
--------------------------------------------
Maybe I am missing something, but I don't see where this [change|[https://github.com/apache/cassandra/blame/trunk/src/java/org/apache/cassandra/utils/vint/VIntCoding.java#L217]] handles the case where the buffer doesn't have 8 bytes remaining? It looks like it wouldn't write the value at all in the scenario where say size is 4 and the buffer has only 4 bytes remaining?
{code:java}
else if (size < 9)
{
int limit = output.limit();
int pos = output.position();
if (limit - pos >= size)
{
int shift = (8 - size) << 3;
int extraBytes = size - 1;
long mask = (long)VIntCoding.encodeExtraBytesToRead(extraBytes) << 56;
long register = (value << shift) | mask;
output.putLong(pos, register);
output.position(pos + size);
}
}{code}
> VIntCoding should read and write more efficiently
> -------------------------------------------------
>
> Key: CASSANDRA-15215
> URL: https://issues.apache.org/jira/browse/CASSANDRA-15215
> Project: Cassandra
> Issue Type: Bug
> Components: Local/Compaction, Local/SSTable
> Reporter: Benedict Elliott Smith
> Assignee: Alex Sorokoumov
> Priority: Normal
> Fix For: 4.1-alpha1, 4.1
>
> Attachments: testWriteRandomLongDOP_final.png, writeUnsignedVInt_megamorphic_BB.png, writeUnsignedVInt_megamorphic_DOP.png
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> Most vints occupy significantly fewer than 8 bytes, and most buffers have >= 8 bytes spare, in which case we can construct the relevant bytes in a register and memcpy them to the correct position. Since we read and write a lot of vints, this waste is probably measurable, particularly during compaction and flush, and can probably be considered a performance bug.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org