protocolbuffers/protobuf

Protobuf java generate to large methods

Open

#10,247 opened on Jul 12, 2022

View on GitHub
 (1 comment) (2 reactions) (0 assignees)C++ (16,128 forks)batch import
enhancementhelp wantedjavajava-liteperformance

Repository metrics

Stars
 (71,223 stars)
PR merge metrics
 (Avg merge 2d 11h) (185 merged PRs in 30d)

Description

What version of protobuf and what language are you using? Version: main Language: Java

What operating system (Linux, Windows, ...) and version? Any

What runtime / compiler are you using (e.g., python version or gcc version) Any

What did you do? Steps to reproduce the behavior:

Create .proto file with around 1.000 fields like

message LargeMessage { optional string s2 = 2; optional int32 i3 = 3; .... optional string s998 = 998; optional int32 i999 = 99; }

Compile it with protoc

You get too large methods for Java JIT compiler. Default compilation limit is 8000 bytes of byte code. It will work, but in interpreter mode. Very very slow.

What did you expect to see bytecode_estimate calculation and split large methods with MaybeRestartJavaMethod(...)

What did you see instead? Large methods

Additional It may be fixed with some java flags https://stackoverflow.com/questions/57005557/jit-c2-method-maximum-size But it's not good solution. Split large method it's better.

Contributor guide