dmsolr commented on issue #3064: To improve DataCarrier 
URL: https://github.com/apache/skywalking/issues/3064#issuecomment-511335940
 
 
   About the max capacity is 200k. **ArrayList has the better ops and take more 
GC times, but cost less.** It is amazing.
   
   ```java
   
       @Benchmark
       public void testArrayList200K() {
           ArrayList<SampleData> list = new ArrayList<SampleData>(4000);
           for (int times=0; times<1000; times++) {
               for (int pos=0; pos<200000; pos++) {
                   list.add(new SampleData());
               }
               list.clear();
           }
       }
   
       @Benchmark
       public void testReusedLinked200K() {
           LinkedList<SampleData> list = new LinkedList<SampleData>();
           for (int times=0; times<1000; times++) {
               for (int pos=0; pos<200000; pos++) {
                   list.add(new SampleData());
               }
               list.clear();
           }
       }
   
       @Benchmark
       public void testLinked200K() {
           for (int times=0; times<1000; times++) {
               LinkedList<SampleData> list = new LinkedList<SampleData>();
               for (int pos=0; pos<200000; pos++) {
                   list.add(new SampleData());
               }
           }
       }
   ```
   Result:
   ```
   Benchmark                                                                    
Mode  Cnt           Score          Error   Units
   LinkedArrayBenchmark.testArrayList200K                                      
thrpt    5           0.812 ±        0.089   ops/s
   LinkedArrayBenchmark.testArrayList200K:·gc.alloc.rate                       
thrpt    5        3553.772 ±      398.861  MB/sec
   LinkedArrayBenchmark.testArrayList200K:·gc.alloc.rate.norm                  
thrpt    5  4802736145.200 ±       10.332    B/op
   LinkedArrayBenchmark.testArrayList200K:·gc.churn.PS_Eden_Space              
thrpt    5        3554.349 ±      392.149  MB/sec
   LinkedArrayBenchmark.testArrayList200K:·gc.churn.PS_Eden_Space.norm         
thrpt    5  4803581996.267 ± 34330566.135    B/op
   LinkedArrayBenchmark.testArrayList200K:·gc.churn.PS_Survivor_Space          
thrpt    5          24.179 ±        3.090  MB/sec
   LinkedArrayBenchmark.testArrayList200K:·gc.churn.PS_Survivor_Space.norm     
thrpt    5    32674873.111 ±  1225690.282    B/op
   LinkedArrayBenchmark.testArrayList200K:·gc.count                            
thrpt    5        1273.000                 counts
   LinkedArrayBenchmark.testArrayList200K:·gc.time                             
thrpt    5       11674.000                     ms
   
   LinkedArrayBenchmark.testReusedLinked200K                                   
thrpt    5           0.250 ±        0.007   ops/s
   LinkedArrayBenchmark.testReusedLinked200K:·gc.alloc.rate                    
thrpt    5        2196.510 ±       62.548  MB/sec
   LinkedArrayBenchmark.testReusedLinked200K:·gc.alloc.rate.norm               
thrpt    5  9600000176.000 ±        0.001    B/op
   LinkedArrayBenchmark.testReusedLinked200K:·gc.churn.PS_Eden_Space           
thrpt    5        2195.758 ±       44.272  MB/sec
   LinkedArrayBenchmark.testReusedLinked200K:·gc.churn.PS_Eden_Space.norm      
thrpt    5  9596847166.400 ± 99649380.997    B/op
   LinkedArrayBenchmark.testReusedLinked200K:·gc.churn.PS_Survivor_Space       
thrpt    5          24.604 ±        3.520  MB/sec
   LinkedArrayBenchmark.testReusedLinked200K:·gc.churn.PS_Survivor_Space.norm  
thrpt    5   107513992.533 ± 12501959.808    B/op
   LinkedArrayBenchmark.testReusedLinked200K:·gc.count                         
thrpt    5         922.000                 counts
   LinkedArrayBenchmark.testReusedLinked200K:·gc.time                          
thrpt    5       12103.000                     ms
   
   LinkedArrayBenchmark.testLinked200K                                         
thrpt    5           0.375 ±        0.011   ops/s
   LinkedArrayBenchmark.testLinked200K:·gc.alloc.rate                          
thrpt    5        3283.321 ±       88.875  MB/sec
   LinkedArrayBenchmark.testLinked200K:·gc.alloc.rate.norm                     
thrpt    5  9600000109.600 ±       13.776    B/op
   LinkedArrayBenchmark.testLinked200K:·gc.churn.PS_Eden_Space                 
thrpt    5        3284.087 ±       91.468  MB/sec
   LinkedArrayBenchmark.testLinked200K:·gc.churn.PS_Eden_Space.norm            
thrpt    5  9602229858.400 ± 15430474.683    B/op
   LinkedArrayBenchmark.testLinked200K:·gc.churn.PS_Survivor_Space             
thrpt    5          36.178 ±        6.896  MB/sec
   LinkedArrayBenchmark.testLinked200K:·gc.churn.PS_Survivor_Space.norm        
thrpt    5   105760358.400 ± 17865836.630    B/op
   LinkedArrayBenchmark.testLinked200K:·gc.count                               
thrpt    5        1231.000                 counts
   LinkedArrayBenchmark.testLinked200K:·gc.time                                
thrpt    5       16275.000                     ms
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to