Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
iter_entry_point often spending a lot of time on parsing a dummy requirements string #1132
When investigating a performance issue on a tool that makes use of setuptools entry points , profiling pointed at iter_entry_points as a hot point (see flamegraph attached to ), with iter_entry_points surprisingly spending a lot of time in pyparsing.
Digging further it appears that when an EntryPoint is created, even without anything in "extras", Requirements.parse is still called (see ) and ultimately results in parsing a "dummy" (because mostly empty) requirements string: "x".
Avoiding the call to Requirements.parse when extras is empty (patch below), leads to a significant improvement of iter_entry_points performance.
(with 17 entry points in the "openstack.cli.extension" group)
time with original code: 0.969233036041
added a commit
Sep 8, 2017
referenced this issue
Sep 8, 2017
I've been unable to replicate your findings. When I try running timeit on iter_entry_points, I'm seeing results in the ~0.09 ballpark:
Is there a test that can replicate the undesirable behavior without a third-party package? If not, can you describe steps to create an environment that does readily show the slow behavior?