Skip to content

Fix trump-void1 move ordering to restore v2.9 search efficiency#213

Open
tameware wants to merge 2 commits into
dds-bridge:developfrom
tameware:speedup-opus
Open

Fix trump-void1 move ordering to restore v2.9 search efficiency#213
tameware wants to merge 2 commits into
dds-bridge:developfrom
tameware:speedup-opus

Conversation

@tameware

Copy link
Copy Markdown
Collaborator

Opus 4.8's fix for 3.0's performance regression v 2.9.

The heuristic extraction refactor changed weight_alloc_trump_void1's first branch from lead_suit == trump to suit == trump. Since that is exhaustive with the following else if (suit != trump), the three ruffing branches (using the 24 - rank + ... formula) became dead code, and trump ruffs were scored with side-suit discard weights instead. This mis-ordered ruffs, costing alpha-beta cutoffs.

The effect is small for solve but compounds heavily in calc's warm-TT iterative deepening: calc explored ~34% more nodes than v2.9. Restoring the original lead_suit == trump pitch branch makes the ruffing
branches reachable again and cuts calc time ~25% (gap to v2.9: 1.37x ->
1.02x). Ordering-only change; double-dummy results are unchanged.

Benchmarks. Compare is the PR code, branch is the develop head.

solver file           compare_avg   branch_avg cmp/branch note
------ ------------- ------------ ------------ ---------- ---------------
solve  list100.txt           2.14         2.24      0.96x compare faster
solve  list10.txt            4.60         4.50      1.02x branch faster
solve  list1.txt            12.00        15.00      0.80x compare faster
calc   list100.txt           9.91        12.34      0.80x compare faster
calc   list10.txt           16.80        23.70      0.71x compare faster
calc   list1.txt            45.00        45.00      1.00x equal

The heuristic extraction refactor changed weight_alloc_trump_void1's
first branch from `lead_suit == trump` to `suit == trump`. Since that
is exhaustive with the following `else if (suit != trump)`, the three
ruffing branches (using the `24 - rank + ...` formula) became dead
code, and trump ruffs were scored with side-suit discard weights
instead. This mis-ordered ruffs, costing alpha-beta cutoffs.

The effect is small for solve but compounds heavily in calc's warm-TT
iterative deepening: calc explored ~34% more nodes than v2.9. Restoring
the original `lead_suit == trump` pitch branch makes the ruffing
branches reachable again and cuts calc time ~25% (gap to v2.9: 1.37x ->
1.02x). Ordering-only change; double-dummy results are unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI 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.

Pull request overview

Restores the intended move-ordering behavior in weight_alloc_trump_void1() by fixing the pitch/ruff branch condition so that trump-ruff scoring logic is reachable again (aligning with the original v2.9-era heuristic behavior and improving alpha-beta cutoff efficiency).

Changes:

  • Switches the first-branch condition in weight_alloc_trump_void1() from suit == trump to lead_suit == trump to correctly model the “lead is trump → we must pitch (void in trump)” case.
  • Re-enables the subsequent trump-ruff weighting branches that were previously made unreachable by the refactor.

Comment thread library/src/heuristic_sorting/heuristic_sorting.cpp Outdated
Per Copilot.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@tameware tameware requested a review from zzcgumn June 28, 2026 00:44
@tameware tameware marked this pull request as ready for review June 28, 2026 00:44
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