Skip to content

Efficiency updates for __str__() methods #4446

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

Merged
merged 1 commit into from
Jul 3, 2025

Conversation

kavanase
Copy link
Contributor

@kavanase kavanase commented Jul 3, 2025

Small change to improve the efficiency of Species.__str__, which can become a bottleneck in some workflows which e.g. subselect sites in a structure based on the species, before doing further processing (e.g. defect site matching in doped).

Improves efficiency by reducing redundant getattr calls.

@kavanase kavanase requested review from shyuep and mkhorton as code owners July 3, 2025 02:45
@kavanase
Copy link
Contributor Author

kavanase commented Jul 3, 2025

The one failing test is an import timing test, which I believe is separate to any changes in this PR

Failed: from pymatgen.core.trajectory import Trajectory import too slow at 607.46 ms! hard_threshold=600.91 ms

@shyuep shyuep merged commit f9d9fe8 into materialsproject:master Jul 3, 2025
43 of 44 checks passed
@shyuep
Copy link
Member

shyuep commented Jul 3, 2025

Thanks.

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