-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Combine dataclass exec calls #109870
Copy link
Copy link
Closed
Labels
performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Feature or enhancement
Proposal:
As mentioned here, dataclass definition can possibly be sped up by combining the multiple
execcalls into one.I have two versions, and I found that this results in either a 1.1-1.22
1.26, or 1.37 speedup versus main(old time / new time)version 1 combines the exec calls by passing a list of name/txt/locals from each function definition.(see below for open pr)version 2 simplifies the final exec call to avoid
__create_fn__, but I'm not experienced to know if that is safe.@ericvsmith Let me know if this is a suitable change, and if so, which version we should open a pr based on.
Thank you!
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
https://discuss.python.org/t/improving-dataclasses-startup-performance/15442/18
Linked PRs