Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Richard's) To profile and analyse algorithmic diff between Google protobuf and Hashgraph's PBJ code #130

Open
alex-kuzmin-hg opened this issue Aug 23, 2024 · 5 comments
Assignees

Comments

@alex-kuzmin-hg
Copy link

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

@alex-kuzmin-hg alex-kuzmin-hg self-assigned this Aug 23, 2024
@alex-kuzmin-hg
Copy link
Author

Got initial report, requested Eng sync to review....

@a-saksena a-saksena changed the title To profile and analyse algorithmic diff between Google protobuf and Hashgraph's code (Richard's) To profile and analyse algorithmic diff between Google protobuf and Hashgraph's PBJ code Aug 30, 2024
@alex-kuzmin-hg
Copy link
Author

pbjAlgCompare2/reports/perf_report.html

@alex-kuzmin-hg
Copy link
Author

Found potential culprit:

Image

@alex-kuzmin-hg
Copy link
Author

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

@alex-kuzmin-hg
Copy link
Author

alex-kuzmin-hg commented Sep 10, 2024

Related fixes:
hashgraph/pbj#283
hashgraph/pbj#284
with that the diff is better:
PBJ runtime is: 12106
Google runtime is: 11626

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant