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

Jonathan Ellis commented on CASSANDRA-950:
------------------------------------------

I'd be more comfortable if we only cache the length on init for read-only BRAF 
modes (thus not having to add any code to the inner loop of our write path).

Incidentally, I found this while googling, indicating that length() makes not 
one but three system calls per invocation.  So this seems like a worthwhile 
optimization.  
http://blogs.oracle.com/charlesLamb/2008/09/javaiorandomaccessfilelength.html

> Cache BufferedRandomAccessFile.length
> -------------------------------------
>
>                 Key: CASSANDRA-950
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-950
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Johan Oskarsson
>         Attachments: CASSANDRA-950.patch
>
>
> Profiling shows that BufferedRandomAccessFile.length is eating up an 
> unexpected amount of cpu. It believe it is the call through the "native 
> barrier" that is causing it. We often call the length method via is end of 
> file when reading data. We can add caching of the file length to avoid this 
> call most times.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to