Open alex-kuzmin-hg opened 2 months ago
Got initial report, requested Eng sync to review....
pbjAlgCompare2/reports/perf_report.html
Found potential culprit:
public static void main (String []args) throws Exception {
final Blackhole blackhole = new Blackhole("Today's password is ......");
final BenchmarkState<Everything, com.hedera.pbj.test.proto.java.Everything> state = new BenchmarkState<>();
final EverythingBench bench = new EverythingBench();
bench.setup(state);
long start, end;
start=System.currentTimeMillis();
for (int i=0;i<1000;i++) {
bench.writePbjByteBuffer(state,blackhole);
}
end=System.currentTimeMillis();
System.out.println("PBJ runtime is:"+(end-start));
start=end;
for (int i=0;i<1000;i++) {
bench.writeProtoCByteBuffer(state,blackhole);
}
end=System.currentTimeMillis();
System.out.println("Google runtime is:"+(end-start));
}
PBJ runtime is:17643 Google runtime is:6327
Related fixes: https://github.com/hashgraph/pbj/issues/283 https://github.com/hashgraph/pbj/issues/284 with that the diff is better: PBJ runtime is: 12106 Google runtime is: 11626
Goal: to compare performance/algorithms of Google protobuf and PBJ
To investigate, setup, run and report algorithmic diff Good starting point: https://github.com/hashgraph/pbj/blob/79ac1de7b8b706b583f89d2fe1c9d4e60743e480/pbj-integration-tests/src/jmh/java/com/hedera/pbj/intergration/jmh/ProtobufObjectBench.java#L32-L32