cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Brown (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-13982) Refactoring to specialised functional interfaces
Date Tue, 31 Oct 2017 17:21:00 GMT

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

Jason Brown commented on CASSANDRA-13982:
-----------------------------------------

I put together a small, naive microbench to compare the autoboxing costs of these functional
interfaces. I ran it several times, and this result is the best case:

{noformat}
     [java] Benchmark                                                                    
   Mode       Cnt        Score   Error  Units
     [java] AutoBoxingBench.booleanFromBooleanSupplier                                   
 sample  12695312       55.727 ± 0.581  ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.00 
  sample                    ≈ 0          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.50 
  sample                 51.000          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.90 
  sample                 71.000          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.95 
  sample                 76.000          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.99 
  sample                 87.000          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.999
  sample                163.000          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p0.9999
 sample              10311.499          ns/op
     [java] AutoBoxingBench.booleanFromBooleanSupplier:booleanFromBooleanSupplier·p1.00 
  sample            1304576.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier                                     
 sample  12239054       60.539 ± 1.076  ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.00     
  sample                    ≈ 0          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.50     
  sample                 54.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.90     
  sample                 75.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.95     
  sample                 78.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.99     
  sample                 90.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.999    
  sample                176.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p0.9999   
  sample              11632.000          ns/op
     [java] AutoBoxingBench.booleanFromPlainSupplier:booleanFromPlainSupplier·p1.00     
  sample            2646016.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier                                           
 sample  12538499       58.154 ± 1.302  ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.00                 
  sample                    ≈ 0          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.50                 
  sample                 50.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.90                 
  sample                 73.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.95                 
  sample                 76.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.99                 
  sample                 89.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.999                
  sample                170.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p0.9999               
  sample              10864.000          ns/op
     [java] AutoBoxingBench.intFromIntSupplier:intFromIntSupplier·p1.00                 
  sample            3813376.000          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier                                         
 sample  12102940       60.167 ± 1.524  ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.00             
  sample                    ≈ 0          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.50             
  sample                 55.000          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.90             
  sample                 74.000          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.95             
  sample                 79.000          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.99             
  sample                 99.000          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.999            
  sample                206.000          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p0.9999           
  sample              11995.294          ns/op
     [java] AutoBoxingBench.intFromPlainSupplier:intFromPlainSupplier·p1.00             
  sample            4743168.000          ns/op
{noformat}

Admittedly, most runs came out equal or the changes in this patch slightly ahead (1-3%). I
wasn't expecting much with benchmark, just to see how garbage creation would affect the results;
thus, i dropped the memory use of the bench from 512MB to 256MB (I tried 128MB, but it was
mostly the same as 256). Of course, those differences won't make much difference in the real
world or running inside a database, but I think the incremental improvement of a little less
garbage is probably worth the effort.

Thus far, the utests look fine, and the dtests will take awhile.

> Refactoring to specialised functional interfaces
> ------------------------------------------------
>
>                 Key: CASSANDRA-13982
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13982
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Ameya Ketkar
>            Assignee: Ameya Ketkar
>            Priority: Minor
>              Labels: static-analysis
>             Fix For: 4.x
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Usage of specialised functional interfaces provided by JDK, will reduce the autoboxing
overhead hence. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message