-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Description
What version of protobuf and what language are you using?
Version: 3.18.0
Language: Python (version 3.7.0)
What operating system (Linux, Windows, ...) and version?
gLinux
What did you do?
Run the below script using protobuf
version 3.17.3
then run it again using protobuf
version 3.18.0
and compare the results. I ran this 30 times per version, each in a fresh python interpreter, and compared the averages.
import proto
from time import time
class ProtoPlusFixture(proto.Message):
name = proto.Field(proto.STRING, number=1)
init_start = time()
pplus = ProtobufFixture()
init = time() - init_start
set_start = time()
pplus.name = "Test"
set_time = time() - set_start
print(f"{init * 1000}, {set_time * 1000}")
What did you expect to see
I expect to see the performance to be similar for each version.
What did you see instead?
- 3.18.0 class init avg. = 0.005571047465
- 3.17.3 class init avg. = 0.004593531291
- 3.18.0 field set avg. = 0.02173582713
- 3.17.3 field set avg. = 0.01894632975
That is a 21% regression in class initialization and a 14% regression when setting fields.
Anything else we should know about your project / environment
We have an internal performance framework that shows that these regressions are significant at a larger scale as well, (i.e. reading and writing several fields, processing larger requests with nested fields) and we began seeing degradations around the time that 3.18.0
was published.