Micro-optimisation: remove no-op body of hot GeneratedMessage.Builder constructor

We are seeing in profiles that this constructor is calling the other constructor.

It doesn't seem to be totally inlined, as the times spent in each constructor
stack frame are different.

In the common case of no builderParent, the constructor can be empty.

PiperOrigin-RevId: 653272368
pull/17451/head
Mark Hansen 5 months ago committed by Copybara-Service
parent efb57278a9
commit 65d4e1817a
  1. 4
      java/core/src/main/java/com/google/protobuf/GeneratedMessage.java

@ -489,9 +489,7 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial
*/
private Object unknownFieldsOrBuilder = UnknownFieldSet.getDefaultInstance();
protected Builder() {
this(null);
}
protected Builder() {}
protected Builder(BuilderParent builderParent) {
this.builderParent = builderParent;

Loading…
Cancel
Save