=rem #16428 optimize protobuf serializer for master

#16428 for master
sure, but please do a `sbt compile` before commiting, it will format the code according to our conventions, thanks