We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
name
>=2.10.0, same as pybind/python_example
>=2.10.0
pybind/python_example
The Enum.name property implemented in #1345 has an unexpected performance characteristic. Namely the larger the enum the longer it takes.
Enum.name
I believe this function gets called
pybind11/include/pybind11/pybind11.h
Line 1988 in 8b48ff8
O(n)
The example is synthetic, but I've run into this being a problem in a real code base.
I've created a reproducible example here: https://github.com/niteria/python_example/tree/linear-enum-name-repro
It just wraps 3 different sizes of enums and measures the time taken by enum.name.
enum.name
niteria/python_example@3b06300 is the only change on top of pybind/python_example.
To run:
~/tmp/python_example$ pip install . ~/tmp/python_example$ python test.py
Output on my computer:
$ python test.py Small time: 0.009021997451782227 seconds Medium time: 0.31952929496765137 seconds Large time: 3.216634511947632 seconds
Not a regression
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
>=2.10.0
, same aspybind/python_example
Problem description
The
Enum.name
property implemented in #1345 has an unexpected performance characteristic.Namely the larger the enum the longer it takes.
I believe this function gets called
pybind11/include/pybind11/pybind11.h
Line 1988 in 8b48ff8
O(n)
in the size of the enum.The example is synthetic, but I've run into this being a problem in a real code base.
Reproducible example code
I've created a reproducible example here: https://github.com/niteria/python_example/tree/linear-enum-name-repro
It just wraps 3 different sizes of enums and measures the time taken by
enum.name
.niteria/python_example@3b06300 is the only change on top of
pybind/python_example
.To run:
Output on my computer:
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: