Skip to content

Conversation

jessekrubin
Copy link
Contributor

Added pyo3::intern!() where applicable.

I imagine this would be beneficial in that some of these call_method/getattr/etc places get called often.

Food for thought: would it be a good idea to dedupe interns pyo3::intern!(py, "run_until_complete") appears twice? would dedupling help?

PS: obviously these are unpaid interns

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Food for thought: would it be a good idea to dedupe interns pyo3::intern!(py, "run_until_complete") appears twice? would dedupling help?

Deduping is potentially useful if it's easy to do; it will reduce the amount of static storage used (by the interior of the macro). I think that the same Python string would be shared between duplicate uses of intern!, though.

@jessekrubin
Copy link
Contributor Author

jessekrubin commented Sep 27, 2025

@davidhewitt I (also) think it would work? but I certainly dont know better than you!

Would inlining possibly cause problems?

I have been sharing (unpaid) interns (here and also-here) and it seems to work good?

EDIT: to clarify, I have been meaning to ask you or make a pyo3 discussion to figure out of intern-deduping actually does anything.


raw links

@jessekrubin
Copy link
Contributor Author

@davidhewitt updated the branch... let me know if I should dedupe

@jessekrubin
Copy link
Contributor Author

@davidhewitt any thoughts on this? is it good to go?

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Sorry for the delay.

@davidhewitt davidhewitt merged commit b90e189 into PyO3:main Oct 9, 2025
33 checks passed
@jessekrubin
Copy link
Contributor Author

No prob.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants