=rem #16428 optimize protobuf serializer for master

#16428 for master
This could be moved to the companion object