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

Sylvain Lebresne commented on CASSANDRA-9499:
---------------------------------------------

bq. with the current scheme this would mostly help values in the range of 
[128..250). I'm not sure if that's worth confusing everything for.

I honestly don't see how that's confusing at all, having some 
{{writePositiveVint}} method on top of just {{writeVint}}, so I do happen to 
think this would be worth it.

bq. we basically lose out a small amount for values in the range 64..128, and 
-256..-1. Everything else we gain.

I typically see cases where that's not ideal. For instance, when serializing 
mutation/result sets, we'll write stuff like the number of columns contained, 
the number of partions, the number of rows in each partition, ... Those will 
most often be small positive numbers, and for those, being able to pack up to 
250 in a single byte would be neat.

bq. we can bias towards positive encodings, since they're more common

We can and I'm not saying it's a bad idea per se, but for what it's worth I do 
prefer having us be explicit on our assumptions. More generally, we know when 
we use those methods what it is we write and I think in almost all case it's 
trivial to know if the number is positive or not, or even if it's very very 
likely small (< 100-200) or not. So I'd personally prefer multiple (simple) 
encodings optimized to certain assumption (obviously, within reason) over a 
single one that makes hidden assumptions that we'll forget most of the time.

But with that said, if having multiple methods sounds awful for some reason, so 
be it.

> 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