Repository navigation
Apply memoization in get_all_universes - #2995
Merged
Merged
Conversation
Contributor
Author
|
One note here is that the pattern: if memo and self in memo:
return {}was pre-existing in other calls using memoization. I stuck with this here for consistency even though this might be more explicit and better: if memo is not None and self in memo:
return {}Happy to update this across the board at the reviewer's request. |
paulromano
requested changes
May 10, 2024
paulromano
left a comment
Contributor
There was a problem hiding this comment.
Thanks for fixing this @pshriwise! Two things seem a little weird to me in the implementation but hopefully it's easy to fix:
paulromano
enabled auto-merge (squash)
May 24, 2024 22:38
church89
pushed a commit
to openmsr/openmc
that referenced
this pull request
Jul 18, 2024
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
apingegno
pushed a commit
to apingegno/openmc
that referenced
this pull request
May 7, 2026
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
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.
Description
While working on a model with TRISO compacts, @aprilnovak noticed that the
Geometry.get_all_universesmethod was taking a long time (3+ hours) -- preplexing as theget_all_cellscall was taking less than a second.It turns out that we weren't using the memoization objects we have in place for this call/chain-of-calls in the geometry objects. This PR adds the use of memoization for that call.
I haven't added any tests here as the set of tests we have in place exercises these methods significantly -- they should just be faster now.
Checklist
I have run clang-format (version 15) on any C++ source files (if applicable)I have made corresponding changes to the documentation (if applicable)I have added tests that prove my fix is effective or that my feature works (if applicable)