You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/10 06:20:16 UTC

[GitHub] [kafka] chia7712 opened a new pull request #9725: MINOR: optimize EvictableKey/LastUsedKey compareTo function

chia7712 opened a new pull request #9725:
URL: https://github.com/apache/kafka/pull/9725


   The previous implementation create two object wraps. 
   
   1. tuple
   2. primitive type -> object type
   
   As ```compareTo``` is hot method in fetch path, it should be worth rewriting them by java code to avoid useless wrap.
   
   **BEFORE**
   ```
   FetchKeyBenchmark.compareEvictableKey                               avgt   15    12.156 ±   0.010   ns/op
   FetchKeyBenchmark.compareEvictableKey:·gc.alloc.rate.norm           avgt   15   112.000 ±   0.001    B/op
   FetchKeyBenchmark.compareLastUsedKey                                avgt   15    13.929 ±   0.088   ns/op
   FetchKeyBenchmark.compareLastUsedKey:·gc.alloc.rate.norm            avgt   15   136.000 ±   0.001    B/op
   ```
   
   **AFTER**
   ```
   FetchKeyBenchmark.compareEvictableKey                      avgt   15   2.351 ±  0.001   ns/op
   FetchKeyBenchmark.compareEvictableKey:·gc.alloc.rate.norm  avgt   15  ≈ 10⁻⁷             B/op
   FetchKeyBenchmark.compareLastUsedKey                       avgt   15   2.154 ±  0.001   ns/op
   FetchKeyBenchmark.compareLastUsedKey:·gc.alloc.rate.norm   avgt   15  ≈ 10⁻⁷             B/op
   ```
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
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:
users@infra.apache.org