Skip to content

Conversation

@joaquimg
Copy link
Contributor

@joaquimg joaquimg commented Feb 20, 2025

Description

Calls to derating_factor(g, tag = r) are a bit expensive as they need to build strings in runtime.
It appears in many loops that involve time, so it shows up in profiling as something meaningful.

Here is a benchmark in a case with 26 areas and 10 weeks:

before:
307.276451 seconds (399.25 M allocations: 24.051 GiB, 48.76% gc time)

after:
269.367580 seconds (332.77 M allocations: 20.677 GiB, 53.52% gc time)

Which is 10% in time and almost 20%(!) in allocations.

What type of PR is this? (check all applicable)

  • Performance Improvements

Related Tickets & Documents

none

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and .md files under /docs/src have been updated if necessary.
  • The latest changes on the target branch have been incorporated, so that any conflicts are taken care of before merging. This can be accomplished either by merging in the target branch (e.g. 'git merge develop') or by rebasing on top of the target branch (e.g. 'git rebase develop'). Please do not hesitate to reach out to the GenX development team if you need help with this.
  • Code has been tested to ensure all functionality works as intended.
  • CHANGELOG.md has been updated (if this is a 'notable' change).
  • I consent to the release of this PR's code under the GNU General Public license.

How this can be tested

.

Post-approval checklist for GenX core developers

After the PR is approved

  • Check that the latest changes on the target branch are incorporated, either via merge or rebase
  • Remember to squash and merge if incorporating into develop

@lbonaldo lbonaldo self-requested a review February 21, 2025 14:26
@lbonaldo lbonaldo changed the base branch from main to develop February 26, 2025 01:15
Copy link
Collaborator

@lbonaldo lbonaldo left a comment

Choose a reason for hiding this comment

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

Thank you, @joaquimg, for creating this PR and contributing to GenX! I've rebased and tested it, and it looks ready to me.

@lbonaldo lbonaldo merged commit 384e60f into GenXProject:develop Feb 26, 2025
7 checks passed
sambuddhac pushed a commit to sambuddhac/GenX.jl that referenced this pull request Mar 5, 2025
NLaws pushed a commit to NLaws/GenX.jl that referenced this pull request Nov 8, 2025
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