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

Tatu Saloranta commented on CASSJAVA-60:
----------------------------------------

I checked out `4.x` branch of 
"https://github.com/apache/cassandra-java-driver.git";.

Yes, the overhead is not about memory usage itself (it being transient) as much 
as cost of allocating and garbage collecting large number of individual small 
buffers unnecessarily. And as I mentioned, there is already an alternate 
implementation that avoids that overhead.

> Improve encoding performance of `CqlVector` by avoiding allocation of large 
> number of temp `ByteBuffer`s
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CASSJAVA-60
>                 URL: https://issues.apache.org/jira/browse/CASSJAVA-60
>             Project: Apache Cassandra Java driver
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Tatu Saloranta
>            Priority: Normal
>
> When profiling service that uses Cassandra Java Driver, inserting rows with 
> Vector columns, I noticed that a significant source of generated garbage (and 
> cpu usage) was due to encoding of `CqlVector` (which is essentially thin 
> wrapper around `List<Float>`).
> A major reason is that value is encoded using delegation so that every 
> individual vector element is encoded separately into throw-away `ByteBuffer` 
> and only appended along with others in the end to get to actual full value.
> It should be possible to instead directly encode element values into fully 
> allocated target buffer (as element count & per-element size are known). And 
> possibly even just remove use of delegation if and when it is known that 
> elements are always `Float`s.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to