Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance regression with repeated fields in Python 3.10 #266

Closed
BenRKarl opened this issue Oct 18, 2021 · 1 comment
Closed

Performance regression with repeated fields in Python 3.10 #266

BenRKarl opened this issue Oct 18, 2021 · 1 comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@BenRKarl
Copy link

BenRKarl commented Oct 18, 2021

Environment details

  • Programming language: Python
  • OS: gLinux
  • Language runtime version: 3.9.5 and 3.10.0
  • Package version: 1.19.0

Steps to reproduce

  1. Run the below script using Python 3.9.5
  2. Run it again using Python 3.10.0 and compare the results
import proto
from timeit import timeit

class Attribute(proto.Message):
    name = proto.Field(
        proto.STRING,
        number=1
    )

class Cat(proto.Message):
    attributes = proto.RepeatedField(
        Attribute,
        number=1,
    )

cat = Cat()
print(timeit(lambda: list(cat.attributes), number=1000))

For more context see the original issue on the Ads library.

@BenRKarl BenRKarl added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 18, 2021
@BenRKarl
Copy link
Author

FYI I think this issue is likely a problem with protobuf defaulting to the python implementation when installed. See 9014 for context. I'm going to close this for now, will reopen if there's any indication of an issue in proto-plus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

1 participant