[ 
https://issues.apache.org/jira/browse/CASSANDRA-15215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17437451#comment-17437451
 ] 

Branimir Lambov commented on CASSANDRA-15215:
---------------------------------------------

A small suggestion: we also need a benchmark that randomly chooses a length, so 
that the branch doesn't always hit the same target and isn't predictable. 
Because in our code we call this encoding for many different types of values, I 
expect unpredictable length to be common.

Also, because we are switching on the exact value of {{size}}, it makes sense 
to put the mask explicitly in the specific cases. To me that also makes it a 
bit easier to read.

If you do use the magic numbers above, please add a comment that they are 
hand-picked to match {{9 - ((magnitude - 1) / 7)}} for {{magnitude}} between 0 
and 63.

> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to