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

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

It's a real shame we can't modify the encoding, or at least, it's not worth the 
effort.

The implementation of read, in particular, could have a much clearer and more 
efficient decoding of size if the negative value positions were inverted.

While we're touching this code, it is worth cleaning up these methods a little: 
there's no point decoding the size of 1, and then deducting from it; we can 
just return immediately if {{{{firstByte}} >= MIN_BYTE_VALUE // == -112}}, and 
always decode the size to a value in the range [2..8]

{vIntIsNegative}}: it has three conditional expressions, and only one of them 
is needed, the other two are always false (since we return those negative 
values up front; and we wouldn't want to invert them anyway, I would guess)

and then {{vintDecodeSize can be made into just a ternary statement.

> 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