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

Make dataclasses efficient #671

Closed
SanjitKal opened this issue Aug 1, 2019 · 1 comment
Closed

Make dataclasses efficient #671

SanjitKal opened this issue Aug 1, 2019 · 1 comment

Comments

@SanjitKal
Copy link
Collaborator

SanjitKal commented Aug 1, 2019

mypyc now supports dataclasses via the non-extension class mechanism introduced in #657. However, the current way they are implemented does not focus on making them fast. Dataclasses are currently simply compiled as non extension classes. It would be nice if they could be compiled as extension classes. The initial issue that arises when trying to treat dataclasses as extension classes is that the dataclass module thinks that all of the class attributes defined in a class decorated with dataclass (and compiled to an extension class) need default values because we have descriptor objects for every class attribute in the class dict. One initial attempt to make things faster would be to pull out all the descriptors from the dictionary, call dataclass on the extension class, and then put them back in. There are other possibilities for optimization, but this would be a useful first pass.

@msullivan
Copy link
Collaborator

Fixed in python/mypy#7817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants