protobuf
protobuf copied to clipboard
Protobuf java generate to large methods
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.
I doubt we will have time to pursue this optimization any time soon. If you are feeling ambitious, you could try to implement it, but I do not think this would be a small thing.