richardstartin opened a new pull request #8124:
URL: https://github.com/apache/pinot/pull/8124


   I noticed very high allocation rate from using `ExpressionContext` as a 
`HashMap` key when profiling a benchmark:
   <img width="1307" alt="Screenshot 2022-02-04 at 00 19 36" 
src="https://user-images.githubusercontent.com/16439049/152452326-2e13ce08-b3aa-4b60-9575-e7fc0b998861.png";>
   
   This is because `Arrays.hashCode` boxes its arguments.
   
   Computing the hash code manually reduces allocation in benchmark runs 
significantly:
   
   before
   ```
   Benchmark                                                                    
           (_intBaseValue)  (_numRows)  Mode  Cnt        Score          Error   
Units
   BenchmarkFilteredAggregations.testFilteredAggregations:·gc.alloc.rate.norm   
                         0     1500000  avgt    5   477029.513 ±     4265.923   
 B/op
   
BenchmarkFilteredAggregations.testNonFilteredAggregations:·gc.alloc.rate.norm   
                      0     1500000  avgt    5  1453348.554 ±    38671.676    
B/op
   ```
   
   after
   ```
   Benchmark                                                                    
           (_intBaseValue)  (_numRows)  Mode  Cnt        Score          Error   
Units
   BenchmarkFilteredAggregations.testFilteredAggregations:·gc.alloc.rate.norm   
                         0     1500000  avgt    5   372573.234 ±   299663.490   
 B/op
   
BenchmarkFilteredAggregations.testNonFilteredAggregations:·gc.alloc.rate.norm   
                      0     1500000  avgt    5  1085451.680 ±  1751019.851    
B/op
   ```
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to