Skip to content

Commit dadc151

Browse files
oharboeclaude
andcommitted
rsz: cache bufferCin() in the buffer-size comparator
Per review, hoist bufferCin() into locals so each comparison does two port-cap lookups instead of up to four. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 3f745e7 commit dadc151

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/rsz/src/Rebuffer.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,8 +1500,10 @@ void Rebuffer::init()
15001500
}
15011501

15021502
std::ranges::sort(buffer_sizes_, [=](BufferSize a, BufferSize b) {
1503-
if (bufferCin(a.cell) != bufferCin(b.cell)) {
1504-
return bufferCin(a.cell) < bufferCin(b.cell);
1503+
const float cin_a = bufferCin(a.cell);
1504+
const float cin_b = bufferCin(b.cell);
1505+
if (cin_a != cin_b) {
1506+
return cin_a < cin_b;
15051507
}
15061508
return a.cell->id() < b.cell->id();
15071509
});

src/rsz/src/RepairDesign.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,10 @@ void RepairDesign::findBufferSizes()
647647
resizer_->buffer_fast_sizes_.end()};
648648
std::ranges::sort(buffer_sizes_,
649649
[=](sta::LibertyCell* a, sta::LibertyCell* b) {
650-
if (bufferCin(a) != bufferCin(b)) {
651-
return bufferCin(a) < bufferCin(b);
650+
const float cin_a = bufferCin(a);
651+
const float cin_b = bufferCin(b);
652+
if (cin_a != cin_b) {
653+
return cin_a < cin_b;
652654
}
653655
return a->id() < b->id();
654656
});

0 commit comments

Comments
 (0)