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 2022/02/02 18:25:59 UTC
[GitHub] [kafka] jasonk000 commented on pull request #11721: KAFKA-13629: use faster algorithm for ByteUtils sizeOfXxx algorithm
jasonk000 commented on pull request #11721:
URL: https://github.com/apache/kafka/pull/11721#issuecomment-1028229086
Good spot on jmh 1.34, TIL! Here's a result from a re-run
```
jkoch@jkoch:~/code/kafka$ java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-Ubuntu-121.10)
OpenJDK 64-Bit Server VM (build 17.0.1+12-Ubuntu-121.10, mixed mode, sharing)
```
```
jkoch@jkoch:~/code/kafka$ cat gradle/dependencies.gradle | grep jmh
jmh: "1.34",
jmhCore: "org.openjdk.jmh:jmh-core:$versions.jmh",
jmhCoreBenchmarks: "org.openjdk.jmh:jmh-core-benchmarks:$versions.jmh",
```
Benchmarks
```
Benchmark Mode Cnt Score Error Units
ByteUtilsBenchmark.testSizeOfUnsignedVarintMathOne thrpt 5 520507.594 ± 3323.803 ops/ms
ByteUtilsBenchmark.testSizeOfUnsignedVarintOne thrpt 5 1035024.683 ± 25061.922 ops/ms
ByteUtilsBenchmark.testSizeOfUnsignedVarintOriginalOne thrpt 5 676262.808 ± 4065.238 ops/ms
```
With `-perfnorm`, the interesting results seem to be:
- IPC, cache miss rates are similarly good across all
- The math version has 2 branches, the lookup table has 3 branches, and the baseline loop has 6 branches. All well predicted.
- It seems to come simply down to instruction counts: math has 31, lookup has 15, and baseline has 27.
```
Benchmark Mode Cnt Score Error Units
ByteUtilsBenchmark.testSizeOfUnsignedVarintMathOne thrpt 5 520507.594 ± 3323.803 ops/ms
ByteUtilsBenchmark.testSizeOfUnsignedVarintMathOne:IPC thrpt 4.759 insns/clk
ByteUtilsBenchmark.testSizeOfUnsignedVarintMathOne:branches thrpt 2.002 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintMathOne:cycles thrpt 6.518 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintMathOne:instructions thrpt 31.016 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintOne thrpt 5 1035024.683 ± 25061.922 ops/ms
ByteUtilsBenchmark.testSizeOfUnsignedVarintOne:IPC thrpt 4.576 insns/clk
ByteUtilsBenchmark.testSizeOfUnsignedVarintOne:branches thrpt 3.000 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintOne:cycles thrpt 3.278 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintOne:instructions thrpt 15.000 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintOriginalOne thrpt 5 676262.808 ± 4065.238 ops/ms
ByteUtilsBenchmark.testSizeOfUnsignedVarintOriginalOne:IPC thrpt 5.385 insns/clk
ByteUtilsBenchmark.testSizeOfUnsignedVarintOriginalOne:branches thrpt 6.001 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintOriginalOne:cycles thrpt 5.016 #/op
ByteUtilsBenchmark.testSizeOfUnsignedVarintOriginalOne:instructions thrpt 27.013 #/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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org