suneet-s opened a new pull request, #12447:
URL: https://github.com/apache/iceberg/pull/12447

   String#format uses regexes internally which can be expensive when used 
repeatedly. This PR switches out the implementation for a char array 
implementation that pads zeros as needed.
   
   A simple benchmark was written to compare these 2 implementations which 
shows an improvement from ~ 300ns per op to 15ns per op
   
   ```
   Benchmark                                    (monthOrdinal)  Mode  Cnt    
Score     Error  Units
   DateFormattingBenchmark.charArrayFormat               0  avgt   10   17.580 
±   5.029  ns/op
   DateFormattingBenchmark.charArrayFormat               1  avgt   10   16.082 
±   0.220  ns/op
   DateFormattingBenchmark.charArrayFormat              12  avgt   10   13.504 
±   0.151  ns/op
   DateFormattingBenchmark.charArrayFormat              15  avgt   10   13.541 
±   0.684  ns/op
   DateFormattingBenchmark.charArrayFormat             123  avgt   10   17.616 
±   5.112  ns/op
   DateFormattingBenchmark.charArrayFormat            1234  avgt   10   13.350 
±   0.544  ns/op
   DateFormattingBenchmark.charArrayFormat           12345  avgt   10   13.656 
±   0.128  ns/op
   DateFormattingBenchmark.stringFormat                      0  avgt   10  
296.576 ±   1.027  ns/op
   DateFormattingBenchmark.stringFormat                      1  avgt   10  
356.724 ± 277.416  ns/op
   DateFormattingBenchmark.stringFormat                     12  avgt   10  
320.441 ±   1.802  ns/op
   DateFormattingBenchmark.stringFormat                     15  avgt   10  
298.042 ±  11.098  ns/op
   DateFormattingBenchmark.stringFormat                    123  avgt   10  
302.227 ±  11.005  ns/op
   DateFormattingBenchmark.stringFormat                   1234  avgt   10  
309.586 ±  11.386  ns/op
   DateFormattingBenchmark.stringFormat                  12345  avgt   10  
305.583 ±   1.682  ns/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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to