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

_decimal: Store a module state in objects for faster access #124688

Closed
neonene opened this issue Sep 27, 2024 · 1 comment
Closed

_decimal: Store a module state in objects for faster access #124688

neonene opened this issue Sep 27, 2024 · 1 comment
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@neonene
Copy link
Contributor

neonene commented Sep 27, 2024

Feature or enhancement

Proposal:

It is known to be efficient to get a module state from an object directly rather than from a type. The same can go for the _decimal's context object (i.e. extending the PyDecContextObject struct).

Extending PyDecObject, which made no perf difference for me, seems to be a waste of memory with many objects.

cc @vstinner @erlend-aasland @mdboom

Links to previous discussion of this feature:

Linked PRs

@neonene neonene added the type-feature A feature request or enhancement label Sep 27, 2024
vstinner pushed a commit that referenced this issue Sep 28, 2024
Get a module state from ctx objects for performance.
@picnixz picnixz added the extension-modules C modules in the Modules dir label Sep 28, 2024
@picnixz
Copy link
Contributor

picnixz commented Sep 28, 2024

Closing since completed in dc12237.

@picnixz picnixz closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants