Skip to content

Merge links into nodes: Fix performance regression topological node output - #1556

Merged
mgovers merged 2 commits into
mainfrom
pgm/feature/performance-topo-node-output
Aug 27, 2026
Merged

Merge links into nodes: Fix performance regression topological node output#1556
mgovers merged 2 commits into
mainfrom
pgm/feature/performance-topo-node-output

Conversation

@mgovers

@mgovers mgovers commented Aug 27, 2026

Copy link
Copy Markdown
Member

Fixes #1554

Relates to #1555

There are potentially some other locations remaining where SmallVector can make a difference (in particular, topological node construction on the input side and the vectors internally in the link solver implementation), but for that, #1555 needs to be merged first. This fix is standalone. Instead, this PR fixes on the big fish.

Credits to @marhofmann for finding the issue.

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers mgovers self-assigned this Aug 27, 2026
@mgovers mgovers added the improvement Improvement on internal implementation label Aug 27, 2026
@mgovers mgovers changed the title performance bypass link solver if needed Fix: performance regression topological node output Aug 27, 2026
@mgovers

mgovers commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@marhofmann would you be able to run the benchmark to see if this fixes the issue for you as well?

@mgovers mgovers changed the title Fix: performance regression topological node output Merging links into nodes: Fix performance regression topological node output Aug 27, 2026
@mgovers mgovers changed the title Merging links into nodes: Fix performance regression topological node output Merge links into nodes: Fix performance regression topological node output Aug 27, 2026
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@sonarqubecloud

Copy link
Copy Markdown

@marhofmann

Copy link
Copy Markdown
Contributor

@marhofmann would you be able to run the benchmark to see if this fixes the issue for you as well?

@mgovers Thanks and I am glad it was useful! I'm benchmarking your version now.

I had the same fix in mind, but it drops call_count from 2 to 1 and means removing the recorded_edges[1] / recorded_loads[1] assertions. Those looked deliberate and I couldn't tell whether they were guarding something I was overlooking. Good to see you've made the same call.

@mgovers
mgovers added this pull request to the merge queue Aug 27, 2026
@mgovers

mgovers commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@marhofmann would you be able to run the benchmark to see if this fixes the issue for you as well?

@mgovers Thanks and I am glad it was useful! I'm benchmarking your version now.

I had the same fix in mind, but it drops call_count from 2 to 1 and means removing the recorded_edges[1] / recorded_loads[1] assertions. Those looked deliberate and I couldn't tell whether they were guarding something I was overlooking. Good to see you've made the same call.

Hi @marhofmann, thanks! I already sent it to merge queue to get it out quickly, but feel free to reply once you have the numbers!

Indeed the calls were deliberate and that also amounts to my comment in #1556 (comment)

@marhofmann

marhofmann commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

@marhofmann would you be able to run the benchmark to see if this fixes the issue for you as well?

@mgovers Benchmarked it:
Produce output on the 2605-node benchmark grid, 1000-scenario batch, 8 interleaved rounds:

Whole batch run 4.24 s → 2.30 s. The remaining ~1.9× above pre-#1536 looks like the extra per-node vectors, so that should line up with what you expect from #1555.

Merged via the queue into main with commit 2e789d9 Aug 27, 2026
34 checks passed
@mgovers
mgovers deleted the pgm/feature/performance-topo-node-output branch August 27, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement on internal implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Result-production ~10x slower on main since #1536

3 participants