-
Notifications
You must be signed in to change notification settings - Fork 100
Serialization/conversion performance improvements #2081
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
base: main
Are you sure you want to change the base?
Conversation
mattwthompson
commented
Jul 9, 2025
- Tag issue being addressed
- Add tests
- Update docstrings/documentation, if applicable
- Lint codebase
- Update changelog
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
Bummer, the behavior seems fine: In [3]: hash(ForceField("openff-2.0.0.offxml")['vdW'])
Out[3]: -7474900899989015509
In [4]: hash(ForceField("openff-2.1.0.offxml")['vdW'])
Out[4]: -7474900899989015509
In [5]: hash(ForceField("openff-2.2.1.offxml")['vdW'])
Out[5]: -2512421923988562758 and the raw performance isn't terrible: In [6]: %%timeit
...: hash(ForceField("openff-2.2.1.offxml")['vdW'])
...:
...:
80.5 ms ± 1.44 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) but something somewhere is causing huge slowdowns, or this just doesn't scale well to large systems. That's what's up next. |
ParameterHandler.__hash__
unitless_value: float | int | NDArray | list = input_quantity.m_as(input_quantity.units) | ||
unitless_value: float | int | NDArray | list = input_quantity.m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there was a reason to convert this quantity into the units it already has
# Try matching the case where there are two indices | ||
# this indicates a index_mapped parameter | ||
attr_name, index, key = self._split_attribute_index_mapping(item) | ||
if not item.isalpha(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is not free, but it improves the current design by not checking for indexed or indexed + mapped attributes if an attribute name is alphabetic