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

Benedict Elliott Smith commented on CASSANDRA-15215:
----------------------------------------------------

Thanks [~Gerrrr], I took a quick look to see if I could shave any further time 
and have the following 
[suggestions|https://github.com/belliottsmith/cassandra/tree/15215-trunk]. On 
my laptop at least the changes to {{ByteBuffer}} result in ~1ns reduction (or 
about 6% improvement). I also took the liberty of modifying the 
{{DataOutputPlus}} specification to use the top bytes of the register to permit 
the {{ByteBuffer}} and {{DataOutputPlus}} implementations to look approximately 
the same, and applied your original optimisation for VIntCoding to the default 
implementation of {{writeBytes}}.

We should probably add a unit test or two to cover {{DataOutputPlus}} vint 
coding and {{writeBytes}} before we commit, but overall the patch is looking 
good.

> 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
>
>         Attachments: writeUnsignedVInt_megamorphic_BB.png, 
> writeUnsignedVInt_megamorphic_DOP.png
>
>
> 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.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to