You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (Jira)" <ji...@apache.org> on 2021/11/02 09:49: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=17437244#comment-17437244 ] 

Benjamin Lerer commented on CASSANDRA-15215:
--------------------------------------------

This ticket might be a good place to also improve the performance of the [computeUnsignedVIntSize|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/utils/vint/VIntCoding.java#L279] method which relies on a division operation. 
[~blambov] mentioned to me that: 
{code}
return 9 - ((magnitude - 1) / 7);
{code}
could be replaced by
{code}
return (639 - magnitude * 9) >> 6;
{code}
which produce the same result and avoid the division high cost in term of CPU time.  

> 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: Aleksandr Sorokoumov
>            Priority: Normal
>             Fix For: 3.0.x, 3.11.x, 4.x
>
>
> 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.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org