Repository navigation
Enhance ASEAtomsData with available properties caching - #792
sundusaijaz wants to merge 2 commits into
Conversation
sundusaijaz
commented
Aug 12, 2026
- feat: add caching for available properties in ASEAtomsData to improve performance
- fix: reset cached properties when metadata is updated
* feat: add caching for available properties in ASEAtomsData to improve performance * fix: reset cached properties when metadata is updated
dajiaohuang
left a comment
There was a problem hiding this comment.
One API behavior concern in the cache change: available_properties now returns the cached mutable List itself. Previously each property read built a fresh list from metadata. A caller that mutates the returned list (the public annotation remains List[str]) will now corrupt the cached value until metadata is reset, and later load_properties validation can then accept/reject properties incorrectly. Could this return a copy (or use an immutable internal representation) and add a small regression test for caller mutation?
|
@dajiaohuang, thanks for the comment. |
With load_properties left at its default of None, every sample reopened the database to read the metadata, at about 0.55 ms per read. The property names are now read once and kept until the metadata is written again. available_properties returns a copy, so that callers cannot change the cached list and with it the validation of load_properties. Based on #792. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>