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

Benedict commented on CASSANDRA-10322:
--------------------------------------

Certainly I'm not wed to the current approach, but we skipBytes _a lot_, and we 
have to have a loop somewhere - having the loop inside of the virtual 
invocation makes the most sense. What I've effectively done here is strengthen 
the contract of {{skipBytes}} in {{DataInputPlus}} - but I haven't declared 
this in the interface (which at the time I was a little torn on - given every 
single {{DataInput}} we've used has always honoured this stronger contract), so 
I would like to suggest either:

# Redeclaring {{skipBytes}} in {{DataInputPlus}} and making it clear that any 
implementor must skip fully unless EOF is reached _only_
# Declaring a new {{skipBytesFully}} in {{DataInputPlus}}

I prefer the former, as it is less code; I just opted not to actually redeclare 
it.

> skipBytes is used extensively, but is slow
> ------------------------------------------
>
>                 Key: CASSANDRA-10322
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10322
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benedict
>            Priority: Trivial
>             Fix For: 3.0.x
>
>
> We skip a great deal to avoid materializing data. Ironically, however, 
> skipping is just as (perhaps more) expensive, as it allocates a temporary 
> array of the size of the number of bytes we want to skip.
> This trivial patch implements {{skipBytes}} more efficiently, and simplifies 
> {{FileUtils.skipBytesFully}}



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

Reply via email to