Skip to content

Skip redundant dataset copy in apply_uprating#1523

Merged
nwoodruff-co merged 1 commit intomainfrom
fix/apply-uprating-redundant-copy
Mar 10, 2026
Merged

Skip redundant dataset copy in apply_uprating#1523
nwoodruff-co merged 1 commit intomainfrom
fix/apply-uprating-redundant-copy

Conversation

@nwoodruff-co
Copy link
Contributor

Summary

  • Adds a copy parameter (default True) to apply_uprating so callers can opt out of the defensive deep copy of the full multi-year dataset
  • extend_single_year_dataset now passes copy=False since it already copies each year individually via dataset.copy() — the second copy was redundant
  • External callers of apply_uprating retain the existing safe-by-default behaviour

This is the proper upstream fix for the monkey-patch used in policyengine.py#251 to avoid the redundant copy in the UK simulation run.

Test plan

  • Existing tests pass
  • Benchmark in policyengine.py#251 confirms no change in output values after removing the monkey-patch

…_single_year_dataset

Add copy=False parameter to apply_uprating; extend_single_year_dataset passes
copy=False since it already copies each year individually via dataset.copy().
This removes the unnecessary deep copy of the entire multi-year dataset.
@nwoodruff-co nwoodruff-co merged commit 1f31a8d into main Mar 10, 2026
2 checks passed
@nwoodruff-co nwoodruff-co deleted the fix/apply-uprating-redundant-copy branch March 10, 2026 10:53
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.

1 participant