Repository navigation
Collect filled coverage paths without repeated AoS index searches - #23
Merged
olivhoenen merged 1 commit intoSep 29, 2026
Merged
Conversation
olivhoenen
approved these changes
Sep 29, 2026
olivhoenen
left a comment
Collaborator
There was a problem hiding this comment.
Hi @chupakobra6, thanks for this addition, which is very welcome!
(if affects only the perf when using the -nc option though, so I'm keeping #10 open for the time being)
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10.
Filled-path collection reconstructs each leaf's
node._path, repeatedly scanning parent Arrays of Structures for their indices. Collection is quadratic in AoS length despite caching per(IDS name, occurrence).Add a private depth-first iterator that carries the path prefix and enumerates each AoS once. It preserves concrete, zero-based indices, filled-leaf filtering, and the existing per-occurrence cache. A result is cached only after traversal completes, so an exception cannot leave partial coverage that suppresses a later attempt. Lazy-loaded IDSs retain the existing rejection instead of silently reporting only loaded fields.
Add 16 regression cases covering exact path equivalence, nested and sparse AoS, empty/materialized nodes, distinct IDSs and occurrences, repeated assertions, reordered/resized arrays, lazy netCDF reads, interrupted traversal, and an end-to-end netCDF validation. The scaling test counts AoS accesses at 100, 1,000 and 10,000 elements; a separate test forbids
_pathduring filled-path collection. Add standalone ASV time and peak-memory benchmarks with a fresh collector per measurement.On a synthetic
core_profilesIDS with two ions per profile and five filled leaves per profile, Python 3.12.13 / IMAS-Python 2.3.0 on macOS arm64:Times are medians of three collections, excluding fixture creation, in separate processes for the baseline and fix. Sets match exactly. At 50,000 paths, traced peak Python allocations were 5.460 MiB before and 5.459 MiB after; separate uninstrumented process peak RSS was 223.1 / 224.6 MiB, including the interpreter and IDS.
Validation:
amns_datain the former andthomson_scatteringin the latter.This change targets filled-path collection. It does not reduce database read time or change touched-node path collection in
create_nodes_dict(). The internal dataset was unavailable; the synthetic benchmark reproduces its quadratic index-search behavior.