Skip to content

perf: return catchment id by const reference - #989

Merged
hellkite500 merged 1 commit into
NOAA-OWP:masterfrom
hellkite500:ursa/catchment-id-const-ref
Jul 1, 2026
Merged

perf: return catchment id by const reference#989
hellkite500 merged 1 commit into
NOAA-OWP:masterfrom
hellkite500:ursa/catchment-id-const-ref

Conversation

@hellkite500

Copy link
Copy Markdown
Contributor

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.

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 PhilMiller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hellkite500

Copy link
Copy Markdown
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.

@hellkite500
hellkite500 merged commit a6b9cf3 into NOAA-OWP:master Jul 1, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants