My python server is receiving streaming protobuf message and each message is quite big. Currently, I am using MessageToDict to parse the protobuf message. However, I feel it is very slow.
in term of protobuf definition:
message Student {
string name = 1;
string ago = 2;
string address = 3;
string email = 4;
}
message Student {
repeated Person = 1;
}
In terms of Python code:
from google.protobuf.json_format import MessageToDict
items = MessageToDict(university_msg)
the university_msg has many students so it will take a few seconds to convert university_msg to items dictionary.
So I am just wondering anyone know is there a faster way to convert university_msg to items ?
question from:
https://stackoverflow.com/questions/66067237/fastest-way-to-parse-protobuf-message-in-python-currently-i-am-using-messagetod 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…