perf: return catchment id by const reference - #989
Merged
hellkite500 merged 1 commit intoJul 1, 2026
Conversation
get_catchment_id() returned std::string by value, allocating a copy on every call. It is invoked per-catchment, per-timestep on the formulation output path (and in CatchmentAggrDataSelector construction), so the copies add up on large/CONUS runs.
PhilMiller
approved these changes
Jul 1, 2026
PhilMiller
left a comment
Contributor
There was a problem hiding this comment.
I don't mind the copy avoidance, though I'm curious whether there's data supporting this being a noticeable cost, or just intuition. If there is data, it would be good to make some note of it here for future reference.
Contributor
Author
|
This one was more of a side effect of the initial "Seeing a lot of memory pressure running conus runs". #990 was the biggest winner from actual testing, but this change went along for the ride. |
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.
get_catchment_id() returned std::string by value, allocating a copy on every call. It is invoked per-catchment, per-timestep on the formulation output path (and in CatchmentAggrDataSelector construction), so the copies add up on large/CONUS runs.