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

Benedict commented on CASSANDRA-9499:
-------------------------------------

Thanks.

I know Cap'n Proto and our existing code uses a loop, but why not just use {{8 
- Integer.numberOfLeadingZeros\(v\)/8}} ?

The cyclic dependency between {{EncodedDIS}} and AbstractDIS is a bit confusing 
to me. I'd rather we simply marked {{EncodedDIS @Deprecated}}, and moved all of 
the implementation details somewhere that's acyclic.

The read method we can make quite a bit more efficient, with a special version 
of {{prepareReadPrimitive}}: we want the result to be that {{length}} bytes are 
in the buffer for consumptions,but that we are also 8 bytes or more before the 
end of the buffer. This way we can just call 
{{buffer.getLong(buffer.position())}}, then advance its position by {{length}} 
and truncate the long with {{ & (-1L >>> (64 - (length * 8)) }} (where 
{{length}} here excludes the initial size byte)

> Introduce writeVInt method to DataOutputStreamPlus
> --------------------------------------------------
>
>                 Key: CASSANDRA-9499
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9499
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Ariel Weisberg
>            Priority: Minor
>             Fix For: 3.0 beta 1
>
>
> CASSANDRA-8099 really could do with a writeVInt method, for both fixing 
> CASSANDRA-9498 but also efficiently encoding timestamp/deletion deltas. It 
> should be possible to make an especially efficient implementation against 
> BufferedDataOutputStreamPlus.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to