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

Benedict commented on CASSANDRA-9500:
-------------------------------------

I've pushed my suggestions 
[here|https://github.com/belliottsmith/cassandra/commits/9500-suggestions]. 
They consist of:

A few correctness issues:

* The slow path byte swapping was confusing native with little_endian. When 
choosing to swap byte order in the slow path, there is no such thing as a 
native order. We only pick big or little endian, and encode it directly.
* {{writeFloat}} and {{writeDouble}} use {{XtoRawYBits}}, not {{XtoYBits}}; 
this only affects special values, so would be hard to detect (we should come up 
with some tests for this)
* {{doPreCleanup}} was discarding exceptions from the superclass

A few efficiency suggestions:
* {{writeXSlow}} -> {{writeSlow}}
** just one (small) slow implementation, so less code bloat
** {{writeFloat}} and {{writeDouble}}, for efficiency, now delegate to 
{{writeInt}} and {{writeLong}} respectively, since that's effectively what they 
do anyway, just via multiple different branches
* I've tried to shrink the amount of code in {{write(ByteBuffer)}}, and have 
moved the slow path into a {{DontInline}} method

A few stylistic suggestions:
* {{allowDirectWritesToChannel}} -> {{permitMisalignedFlushes}}
* The swapBytes property buys us very little, given the other costs and the 
entry into a non-inlined function, so would prefer to avoid it

Some scope creep:
* The directory syncing was ugly and unnecessarily delayed; I've moved this 
into the channel construction

It would also be nice to expand our {{BBDOSP}} tests to run on this, perhaps 
expanding the size of the data we write, or performing it with a number of 
random buffer sizes, and then checking our code coverage.

> SequentialWriter should extend BufferedDataOutputStreamPlus
> -----------------------------------------------------------
>
>                 Key: CASSANDRA-9500
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9500
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Benedict
>            Assignee: Ariel Weisberg
>            Priority: Minor
>
> SequentialWriter is the last piece left not implementing 
> DataOutputStreamPlus. It should not be too tricky to extend it, and it should 
> result in improved write throughput. Further, it will permit it to exploit 
> the more efficient implementation of writeVInt being delivered in 
> CASSANDRA-9499



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

Reply via email to