=rem #16428 optimize protobuf serializer for master

#16428 for master
we use match Some/None to avoid the allocation, so that is ok here