bridge-solver 2.1.0__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/.github/workflows/ci.yml +8 -0
  2. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/CLAUDE.md +44 -20
  3. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/Cargo.lock +1 -1
  4. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/Cargo.toml +1 -1
  5. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/PKG-INFO +6 -3
  6. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/README.md +9 -4
  7. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/release-profile.md +274 -2
  8. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/docs/claim-checker.md +21 -2
  9. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/docs/cli-guide.md +20 -1
  10. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/README.md +11 -0
  11. bridge_solver-2.2.0/fixtures/divergence/bsalita-freak-nodes.tsv +6 -0
  12. bridge_solver-2.2.0/fixtures/divergence/bsalita-nodes.tsv +202 -0
  13. bridge_solver-2.2.0/fixtures/divergence/freak-tables.pbn +4 -0
  14. bridge_solver-2.2.0/fixtures/divergence/upstream-freak-nodes.tsv +6 -0
  15. bridge_solver-2.2.0/fixtures/divergence/upstream-nodes.tsv +202 -0
  16. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/functions/api/stats.ts +23 -3
  17. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/functions/t.ts +27 -8
  18. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/pyproject.toml +2 -1
  19. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/Cargo.lock +2 -2
  20. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/Cargo.toml +1 -1
  21. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/README.md +3 -1
  22. bridge_solver-2.2.0/scripts/dd-bench-fixture.sh +25 -0
  23. bridge_solver-2.2.0/scripts/upstream-lockstep.sh +67 -0
  24. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/analyse_play.rs +2 -2
  25. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/bin/bridge-claim/main.rs +1 -2
  26. bridge_solver-2.2.0/src/bin/bridge-solver/bench.rs +122 -0
  27. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/bin/bridge-solver/main.rs +43 -9
  28. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/bin/solver-bench/main.rs +3 -4
  29. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/bin/solver-diag/main.rs +1 -1
  30. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/bridge_solver.rs +60 -44
  31. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/cards.rs +6 -6
  32. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/claim.rs +3 -2
  33. bridge_solver-2.2.0/src/dd_bench.rs +168 -0
  34. bridge_solver-2.2.0/src/dd_bench_deals.txt +200 -0
  35. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/hands.rs +87 -2
  36. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/json_api.rs +41 -1
  37. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/lib.rs +5 -4
  38. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/par.rs +44 -1
  39. bridge_solver-2.2.0/src/pattern.rs +1088 -0
  40. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/pattern_vec.rs +139 -39
  41. bridge_solver-2.2.0/src/search.rs +3276 -0
  42. bridge_solver-2.2.0/tests/pool_drain.rs +77 -0
  43. bridge_solver-2.2.0/web/bench.html +197 -0
  44. bridge_solver-2.2.0/web/claim.html +74 -0
  45. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/_headers +7 -0
  46. bridge_solver-2.2.0/web/public/claim-bench.html +15 -0
  47. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/get.html +10 -4
  48. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/privacy.html +12 -6
  49. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/stats.html +18 -1
  50. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/stats.js +85 -19
  51. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/App.vue +28 -1
  52. bridge_solver-2.2.0/web/src/bench/analysis.js +197 -0
  53. bridge_solver-2.2.0/web/src/bench/analysis.worker.js +31 -0
  54. bridge_solver-2.1.0/web/src/claim-bench/main.js → bridge_solver-2.2.0/web/src/bench/claims.js +29 -18
  55. bridge_solver-2.2.0/web/src/bench/lock.js +25 -0
  56. bridge_solver-2.2.0/web/src/bench/main.js +7 -0
  57. {bridge_solver-2.1.0/web/src/claim-bench → bridge_solver-2.2.0/web/src/bench}/style.css +19 -6
  58. bridge_solver-2.2.0/web/src/claim/ClaimApp.vue +610 -0
  59. bridge_solver-2.2.0/web/src/claim/main.js +8 -0
  60. bridge_solver-2.2.0/web/src/claim/style.css +20 -0
  61. bridge_solver-2.2.0/web/src/lib/claims.js +127 -0
  62. bridge_solver-2.2.0/web/src/lib/claims.test.js +92 -0
  63. bridge_solver-2.2.0/web/src/lib/ddBench.js +77 -0
  64. bridge_solver-2.2.0/web/src/lib/ddBench.test.js +66 -0
  65. bridge_solver-2.2.0/web/src/lib/fixtures/claim-bench-v1.json +1 -0
  66. bridge_solver-2.2.0/web/src/lib/fixtures/dd-bench-v1.json +1 -0
  67. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/siteNav.test.js +3 -2
  68. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/solver.js +14 -0
  69. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/solver.worker.js +9 -1
  70. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/telemetry.js +43 -0
  71. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/telemetry.test.js +16 -1
  72. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/vite.config.js +5 -4
  73. bridge_solver-2.1.0/src/pattern.rs +0 -936
  74. bridge_solver-2.1.0/src/search.rs +0 -2075
  75. bridge_solver-2.1.0/web/claim-bench.html +0 -158
  76. bridge_solver-2.1.0/web/src/lib/fixtures/claim-bench-v1.json +0 -1
  77. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/.github/workflows/pages.yml +0 -0
  78. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/.github/workflows/release.yml +0 -0
  79. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/.gitignore +0 -0
  80. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/LICENSE-APACHE +0 -0
  81. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/LICENSE-MIT +0 -0
  82. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/LICENSES/Apache-2.0.txt +0 -0
  83. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/LICENSES/MIT.txt +0 -0
  84. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/LICENSES/THIRD-PARTY-NOTICES +0 -0
  85. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/THIRD-PARTY-NOTICES +0 -0
  86. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/README.md +0 -0
  87. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/METHODOLOGY.md +0 -0
  88. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/RESULTS.md +0 -0
  89. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/build-reference.sh +0 -0
  90. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/case1-latency.svg +0 -0
  91. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/case1-latency.tsv +0 -0
  92. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/case23-throughput.txt +0 -0
  93. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/gen-corpus.py +0 -0
  94. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/latency.sh +0 -0
  95. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/ref-latency.patch +0 -0
  96. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/report.py +0 -0
  97. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/comparison/throughput.sh +0 -0
  98. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/corpus.json +0 -0
  99. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/BASELINE.md +0 -0
  100. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/cache-fix.json +0 -0
  101. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/cache-fix.md +0 -0
  102. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/cache-reuse.md +0 -0
  103. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/mtdf-seed.json +0 -0
  104. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/mtdf-seed.md +0 -0
  105. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/node-counter-after.json +0 -0
  106. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/node-counter-before.json +0 -0
  107. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/release-profile.json +0 -0
  108. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/upstream-node-sweep.txt +0 -0
  109. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/v1.0.0-17-g2e21c93-dirty.json +0 -0
  110. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/bench/results/v1.0.0-31-g4c7a37b-dirty.json +0 -0
  111. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/build.rs +0 -0
  112. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/dev-build.sh +0 -0
  113. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/docs/HANDOFF-phase6.md +0 -0
  114. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/docs/ROADMAP.md +0 -0
  115. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/docs/performance-baseline.md +0 -0
  116. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/examples/bench_fixtures.rs +0 -0
  117. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/examples/time_optimal_line.rs +0 -0
  118. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/bench-boards.lin +0 -0
  119. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/bridge-composer/.gitattributes +0 -0
  120. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/bridge-composer/README.md +0 -0
  121. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/bridge-composer/pbn-order-test-bc-dd.pbn +0 -0
  122. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/bridge-composer/pbn-order-test-bc.pbn +0 -0
  123. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/bridge-composer/pbn-order-test.pbn +0 -0
  124. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.1 +0 -0
  125. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.10 +0 -0
  126. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.12 +0 -0
  127. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.134 +0 -0
  128. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.38 +0 -0
  129. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.4 +0 -0
  130. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.54 +0 -0
  131. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/deal.72 +0 -0
  132. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/first-divergence.sh +0 -0
  133. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/freak.0 +0 -0
  134. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/freak.1 +0 -0
  135. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/freak.2 +0 -0
  136. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/freak.3 +0 -0
  137. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/lockstep-200.pbn +0 -0
  138. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/fixtures/divergence/manifest.tsv +0 -0
  139. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/LICENSES/Apache-2.0.txt +0 -0
  140. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/LICENSES/MIT.txt +0 -0
  141. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/LICENSES/THIRD-PARTY-NOTICES +0 -0
  142. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/RELEASING.md +0 -0
  143. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/bridge_solver/__init__.py +0 -0
  144. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/bridge_solver/py.typed +0 -0
  145. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/src/lib.rs +0 -0
  146. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/python/tests/test_bridge_solver.py +0 -0
  147. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/scripts/claim-bench-fixture.sh +0 -0
  148. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/scripts/third-party-notices.py +0 -0
  149. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/bin/solver-bench/dds.rs +0 -0
  150. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/cache.rs +0 -0
  151. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/claim_bench.rs +0 -0
  152. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/convert.rs +0 -0
  153. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/play.rs +0 -0
  154. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/tests.rs +0 -0
  155. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/src/types.rs +0 -0
  156. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/gallery.html +0 -0
  157. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/index.html +0 -0
  158. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/package-lock.json +0 -0
  159. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/package.json +0 -0
  160. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/THIRD-PARTY-NOTICES +0 -0
  161. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/public/site-nav.css +0 -0
  162. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/assets/tokens.css +0 -0
  163. /bridge_solver-2.1.0/web/src/claim-bench/worker.js → /bridge_solver-2.2.0/web/src/bench/claims.worker.js +0 -0
  164. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/AuctionTable.vue +0 -0
  165. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/BridgeTable.vue +0 -0
  166. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/DebugPanel.vue +0 -0
  167. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/DoubleDummyTable.vue +0 -0
  168. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/ErrorSummary.vue +0 -0
  169. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/HandDisplay.vue +0 -0
  170. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/InputPanel.vue +0 -0
  171. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/NodePanel.vue +0 -0
  172. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/PlayTrace.vue +0 -0
  173. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/PlayerErrors.vue +0 -0
  174. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/SeatPanel.vue +0 -0
  175. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/SolveNote.vue +0 -0
  176. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/components/TrickArea.vue +0 -0
  177. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/benchmark.js +0 -0
  178. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/benchmark.test.js +0 -0
  179. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/cardplay.js +0 -0
  180. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/cardplay.test.js +0 -0
  181. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/cards.js +0 -0
  182. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/cards.test.js +0 -0
  183. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/claimBench.js +0 -0
  184. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/claimBench.test.js +0 -0
  185. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/ddTable.js +0 -0
  186. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/ddTable.test.js +0 -0
  187. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/deal.js +0 -0
  188. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/deal.test.js +0 -0
  189. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/errors.js +0 -0
  190. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/errors.test.js +0 -0
  191. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/example.js +0 -0
  192. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/fixtures/bench-v1.json +0 -0
  193. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/fixtures/bench-v2.json +0 -0
  194. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/input.js +0 -0
  195. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/input.test.js +0 -0
  196. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/perf.js +0 -0
  197. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/perf.test.js +0 -0
  198. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/session.js +0 -0
  199. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/session.test.js +0 -0
  200. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/lib/solver.test.js +0 -0
  201. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/web/src/main.js +0 -0
  202. {bridge_solver-2.1.0 → bridge_solver-2.2.0}/wrangler.jsonc +0 -0
@@ -264,6 +264,14 @@ jobs:
264
264
  matrix:
265
265
  os: [ubuntu-latest, windows-latest, macos-latest]
266
266
  python: ["3.9", "3.13"]
267
+ # ubuntu-latest (26.04) has no Python 3.9 any more; the package still
268
+ # declares >=3.9, so test it on the last image that has it.
269
+ exclude:
270
+ - os: ubuntu-latest
271
+ python: "3.9"
272
+ include:
273
+ - os: ubuntu-24.04
274
+ python: "3.9"
267
275
 
268
276
  steps:
269
277
  - name: Checkout code
@@ -79,30 +79,41 @@ pushover "message" "title" # title defaults to "Claude Code"
79
79
 
80
80
  ## Lock-step with the C++ reference
81
81
 
82
- This is a port of `macroxue/bridge-solver`, and as of 2026-09-02 it searches the
83
- same tree as that project at its 2026-01-31 state — **node for node, on all 200
84
- deals of the reference's own corpus**. That is a property worth keeping, because
85
- it turns any behavioural change into an immediately visible one.
86
-
87
- Two invariants must hold after any change that could touch the search:
82
+ This is a port of `macroxue/bridge-solver`, and it searches the same tree as
83
+ Bob Salita's faster search on top of it (`BSalita/bridge-solver` `b12bb3f`,
84
+ built on upstream `47d30f3`) — **node for node, on every one of the 200 deals
85
+ of the reference's own corpus**, and on the four freak deals solved as full
86
+ tables. That is a property worth keeping, because it turns any behavioural
87
+ change into an immediately visible one. (It first reached lock-step on
88
+ 2026-09-02 against upstream's 2026-01-31 state, `75b4619`; in 2026-11 it was
89
+ brought up to `47d30f3` one upstream commit at a time, then to Bob's search one
90
+ of its seven features at a time, checking each.)
91
+
92
+ After any change that could touch the search:
88
93
 
89
94
  ```bash
90
- ./dev-build.sh --ci run --release --features bench --bin solver-bench -- nodes fixtures/divergence/lockstep-200.pbn
95
+ scripts/upstream-lockstep.sh bob7-second # all 200 deals: 183,796,287 nodes
96
+ scripts/upstream-lockstep.sh --freak bob7-second # 4 freak tables: 577,946,152 nodes
91
97
  ```
92
98
 
93
- must total exactly **296,689,028 nodes**, and
94
-
95
- ```bash
96
- XRAY=<path to built xray/solver-xray> fixtures/divergence/first-divergence.sh
97
- ```
99
+ must report `0 of 200` and `0 of 4` deals differing. The first takes seconds,
100
+ the second a couple of minutes. `fixtures/divergence/upstream-nodes.tsv` holds
101
+ upstream's per-deal node counts at every commit that touched `solver.cc` since
102
+ `75b4619`, and `bsalita-nodes.tsv` Bob's search feature by feature (`bob0-base`
103
+ to `bob7-second`), so porting a later change means adding its column (see
104
+ "Catching up with upstream" and "Bob Salita's faster search" in
105
+ `bench/results/release-profile.md` for how the columns were made) and checking
106
+ against it. A node is counted at the top of `EvaluatePlayableCards`, before
107
+ the second-seat test.
98
108
 
99
- must report `none` for all twelve fixtures. See `fixtures/divergence/README.md`
100
- for what each fixture isolates and how to build the instrumented reference.
109
+ The twelve `first-divergence.sh` fixtures and the instrumented reference
110
+ compare against `75b4619` and no longer apply; see
111
+ `fixtures/divergence/README.md`.
101
112
 
102
113
  Searching *fewer* nodes is a divergence too, not an improvement. Getting to
103
114
  lock-step took five fixes, three of which were ordering bugs in the pattern
104
- tree: `Pattern::lookup` returns the first child that matches, so child order is
105
- semantics rather than housekeeping.
115
+ tree: `Pattern::lookup_in` returns the first child that matches, so child order
116
+ is semantics rather than housekeeping.
106
117
 
107
118
  `bench/results/release-profile.md` is the full record — what was measured, what
108
119
  was tried and found worthless, and where the remaining gap is.
@@ -121,15 +132,28 @@ rules:
121
132
  - Any change to the claim search changes node counts. Rerun
122
133
  `scripts/claim-bench-fixture.sh`, or `matches_the_web_fixture` fails and the
123
134
  benchmark web page reports every browser as wrong.
135
+ - The analysis benchmark (`src/dd_bench.rs`, `bridge-solver --bench`, the
136
+ web benchmarks page) is the lock-step corpus, and its web fixture totals
137
+ 183,796,287 nodes. A change that moves it breaks lock-step anyway; if the
138
+ corpus or the table search ever changes deliberately, rerun
139
+ `scripts/dd-bench-fixture.sh`. `src/dd_bench_deals.txt` must stay a copy of
140
+ `fixtures/divergence/lockstep-200.pbn`; a test checks.
124
141
  - Measure with `bridge-claim bench --json`, comparing verdicts and nodes per
125
142
  row with the fixture. A verdict may only go from `?` to decided.
126
143
 
127
144
  ## Performance work
128
145
 
129
- Current standing, single-threaded over those 200 deals, measured 2026-09-02:
130
- the reference **21,640 ms**, this port **23,090 ms**, DDS 2.9 **20,250 ms**.
131
- With identical node counts, **1.067x is pure per-node cost** with nothing else
132
- mixed in.
146
+ Current standing, single-threaded over those 200 deals, measured 2026-11-16
147
+ on the same tree (Bob Salita's `b12bb3f`, 183,796,287 nodes): Bob's C++ with
148
+ PGO **40.1 G cycles / 9.99 s**, this port **41.1 G cycles / 10.21 s**, a
149
+ default build with no PGO and no CPU-specific flags. With identical node counts
150
+ the remaining **1.025x is per-node cost**. The per-node work that closed most
151
+ of the gap (from 1.318x) is "Per-node work" in `release-profile.md`; it was
152
+ judged on the default native build and on wasm, not on machine-tuned builds,
153
+ because those are what users download. For scale, upstream C++ on its own older
154
+ tree is 53.7 G cycles / 13.31 s. Before the 2026-11 work the port was 22.19 s
155
+ (on `75b4619`'s tree, 1.067x that reference; 2026-09-02: reference 21,640 ms,
156
+ port 23,090 ms, DDS 2.9 20,250 ms).
133
157
 
134
158
  **Run both solvers the way you would actually run them.** The reference must be
135
159
  built with the PGO its own makefile defaults to, and pointed at a multi-deal
@@ -72,7 +72,7 @@ dependencies = [
72
72
 
73
73
  [[package]]
74
74
  name = "bridge-solver"
75
- version = "2.1.0"
75
+ version = "2.2.0"
76
76
  dependencies = [
77
77
  "bridge-encodings",
78
78
  "bridge-types",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "bridge-solver"
3
- version = "2.1.0"
3
+ version = "2.2.0"
4
4
  edition = "2021"
5
5
  license = "MIT OR Apache-2.0"
6
6
  description = "Bridge Double-Dummy Solver - Port of macroxue/bridge-solver"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bridge-solver
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Topic :: Games/Entertainment
@@ -19,7 +19,8 @@ Keywords: bridge,contract bridge,double dummy,dds,claim,par
19
19
  License-Expression: MIT OR Apache-2.0
20
20
  Requires-Python: >=3.9
21
21
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
22
- Project-URL: Claim benchmark, https://bridge-craftwork.com/bridge-solver/claim-bench
22
+ Project-URL: Benchmarks, https://bridge-craftwork.com/bridge-solver/bench.html
23
+ Project-URL: Claim checker, https://bridge-craftwork.com/bridge-solver/claim.html
23
24
  Project-URL: Claim checker design, https://github.com/bridge-craftwork/bridge-solver/blob/main/docs/claim-checker.md
24
25
  Project-URL: Documentation, https://github.com/bridge-craftwork/bridge-solver/blob/main/python/README.md
25
26
  Project-URL: Homepage, https://github.com/bridge-craftwork/bridge-solver
@@ -109,7 +110,9 @@ bs.max_claim(deal, "S", "N", plays=plays, claimer="E")["guaranteed"] # 2
109
110
 
110
111
  How the checker works, and why: [design notes](https://github.com/bridge-craftwork/bridge-solver/blob/main/docs/claim-checker.md).
111
112
  You can time it in your browser on the
112
- [benchmark page](https://bridge-craftwork.com/bridge-solver/claim-bench).
113
+ [benchmark page](https://bridge-craftwork.com/bridge-solver/bench.html#claims),
114
+ and try claims on your own hands on the
115
+ [claim checker page](https://bridge-craftwork.com/bridge-solver/claim.html).
113
116
 
114
117
  ## Licence
115
118
 
@@ -22,11 +22,16 @@ the browser, and a Rust crate to build against.
22
22
  - **Card by card** — not just how many tricks the deal is worth, but what each
23
23
  card played costs against best defence, and what the alternatives were. In the
24
24
  crate and in the browser build.
25
- - **Claims** — `bridge-claim` checks whether a claim holds however the unseen
26
- cards lie, for declarer or a defender, and benchmarks the checker; there is a
27
- [benchmark page](https://bridge-craftwork.com/bridge-solver/claim-bench.html)
28
- that runs the same claims in your browser. How it works and why:
25
+ - **Claims** — checks whether a claim holds however the unseen cards lie, for
26
+ declarer or a defender. Try it on your own hands on the
27
+ [claim checker page](https://bridge-craftwork.com/bridge-solver/claim.html):
28
+ paste a PBN, LIN or BBO hand and claim at any point in the play.
29
+ `bridge-claim` does the same from the command line. How it works and why:
29
30
  [design notes](docs/claim-checker.md).
31
+ - **Benchmarks** — the [benchmarks page](https://bridge-craftwork.com/bridge-solver/bench.html)
32
+ times the analysis and the claim checker in your browser, on fixed deals and
33
+ claims checked against the native tools; `bridge-solver --bench` and
34
+ `bridge-claim bench` run the same work on every core.
30
35
  - **Par scoring** — the optimum score and the contracts that achieve it, given
31
36
  vulnerability: every contract tied at par, and named for a single seat when
32
37
  only one partner can take the tricks, the way Bridge Composer writes them.
@@ -1265,6 +1265,278 @@ measured about 1% and nothing on best-of (21.24 s plain, 21.27 s PGO, above).
1265
1265
  So the build asymmetry in `RESULTS.md` is worth roughly a point in the
1266
1266
  reference's favour, not the seven that separate us.
1267
1267
 
1268
+ ## Catching up with upstream
1269
+
1270
+ 2026-11. The port matched upstream as of `75b4619` (2026-01-31). Measured
1271
+ together on the 200-deal corpus, upstream's 2026-10-01 state (`630705d`, whose
1272
+ `solver.cc` is `47d30f3`'s) was **1.69x** faster than the port, and it was
1273
+ searching a different, smaller tree. So the port was brought up to it one
1274
+ upstream commit at a time, keeping lock-step at every step.
1275
+
1276
+ ### Method
1277
+
1278
+ Upstream counts a node in `EvaluatePlayableCards` (`++stats[depth].num_visits`),
1279
+ exactly where the port does. Each of the 63 upstream commits that touched
1280
+ `solver.cc` from `75b4619` to `47d30f3` was built with a global counter beside
1281
+ that line, and solved every deal of `lockstep-200.pbn` in its own process. The
1282
+ `75b4619` column reproduces the lock-step total, 296,689,028, deal for deal,
1283
+ which is what makes the other columns trustworthy.
1284
+ `fixtures/divergence/upstream-nodes.tsv` keeps all 64 columns, and
1285
+ `scripts/upstream-lockstep.sh COMMIT` checks the port against any of them.
1286
+
1287
+ None of the 200 deals has four voids, so upstream's freak-deal handling
1288
+ (`14ab4c7`, `189f86b`, `3052870`) never runs on them. The four freak fixtures,
1289
+ solved as full 20-cell tables (`freak-tables.pbn`), are checked the same way at
1290
+ the commits that change it (`upstream-freak-nodes.tsv`,
1291
+ `upstream-lockstep.sh --freak`). The single-cell fixtures would not do: the
1292
+ reset happens between cells.
1293
+
1294
+ Each port went in as its own commit, checked against its upstream column before
1295
+ committing. Every one matched on all 200 deals.
1296
+
1297
+ ### What the 63 commits were
1298
+
1299
+ | | commits |
1300
+ |---|---|
1301
+ | ported, moving the tree | 21 |
1302
+ | ported, keeping the tree | 10 |
1303
+ | already equivalent in the port | 5: `24ecd16`, `610e9da`, `ad89f22`, `bac53be`, `925bd40` |
1304
+ | not applicable (web, debug output, stats, formatting, the RNG, the CLI) | 20 |
1305
+ | deferred: speed only | 7: `67d59d5`, `6ebb3dd`, `60c18a9`, `0c53304`, `eea0f63`, `31802f9`, `5306f61` |
1306
+
1307
+ Nodes went from 296,689,028 to **237,671,354 (0.801x)**. The biggest single
1308
+ steps: probing early leads (`3f6be83`, -4.83%), trump length tricks
1309
+ (`f547a97`, -4.29%), the KQ-against-A fix in `SlowTrumpTricks` (`c94c80f`,
1310
+ -3.00%), the target in the cut-off index (`7f2bb9b`, -2.28%).
1311
+
1312
+ Notes worth keeping:
1313
+
1314
+ - **Both of upstream's `Have(Cards)` bugs are fixed**, in `c94c80f` and
1315
+ `0cf82a2`. C++ turned `Have(cards)` into `Have(1)` through `Cards`'
1316
+ `operator bool`, which disabled the KQ-against-A bound and the Q-J and J-T
1317
+ finesse-lead tests; the port copied that on purpose. Both errors were in the
1318
+ safe direction (a test that never fired), so the port was never wrong, only
1319
+ slower.
1320
+ - **`186d3e2` is emulated, not copied.** Upstream now lays a suit out in 16 bits.
1321
+ The search sees that only in the cut-off index, which packs cards back to 52
1322
+ bits but holds the winning card's number in the new layout. The port keeps 13
1323
+ bits and converts that one number (`upstream_card_number`), so the keys, and
1324
+ any 32-bit tag collisions, stay upstream's.
1325
+ - **`bf4a521` shrank the pattern table by two bits** (`PatternCache::DEFAULT_BITS`
1326
+ = 14), as upstream did, because each entry briefly held four patterns. Without
1327
+ it peak RSS rose from 317 MB to 543 MB. After `255a7f7` entries hold four bare
1328
+ lists and the corpus peaks at 259 MB.
1329
+ - **`38f5734` rewrote `Pattern::update`**: lists sorted by order, no bound
1330
+ propagation, adoption of more specific siblings. Matched first time, as did the
1331
+ probe in `3f6be83`, which needed the play bookkeeping factored out of
1332
+ `play_card_and_search` and `search_with_cache` so both share it.
1333
+ - **The claim checker's verdicts did not move**: 1,050 claims, 877 invalid, 159
1334
+ valid, 14 undecided, all as before, with 5.2% fewer nodes.
1335
+
1336
+ ### The speed it bought
1337
+
1338
+ Single-threaded, 200 deals, M4 Pro, 2026-11-14. Five rounds each, interleaved,
1339
+ each run started only when no other process was above 80% CPU and discarded if
1340
+ one went above it during the run. Best of the clean runs:
1341
+
1342
+ | | Gcycles | wall | Ginstr | nodes |
1343
+ |---|---|---|---|---|
1344
+ | port before (`main`) | 90.57 | 22.19 s | 253.0 | 296,689,028 |
1345
+ | **port after** | **68.93** | **16.98 s** | 205.0 | 237,671,354 |
1346
+ | upstream `630705d`, clang PGO | 53.68 | 13.29 s | 166.3 | 237,671,354 |
1347
+
1348
+ **1.314x on cycles, 1.307x on wall.** Of that, 1.248x is the smaller tree and
1349
+ 1.053x cheaper nodes (290 cycles a node against 305).
1350
+
1351
+ The gap to upstream on the same tree is **1.284x**, against 1.061x before the
1352
+ catch-up. It is per-node cost, and most of it is the seven deferred commits plus
1353
+ PGO. They are platform tuning: `60c18a9`'s branchless `PackBits` was faster on a
1354
+ wide core and 10% slower on a narrow one, and upstream routes its no-SIMD WASM
1355
+ build back to the loop. So they need measuring on the port, not copying.
1356
+ `31802f9` (which also keeps `Pattern::Update`'s fields in locals and skips
1357
+ `PackBits` when a suit's remaining cards all outrank the cards just played) and
1358
+ `6ebb3dd` (NEON for `Hands::Include`/`Equals`) are the ones that apply on Apple
1359
+ Silicon.
1360
+
1361
+ ## Upstream's speed-only commits
1362
+
1363
+ 2026-11, after the catch-up. The seven deferred commits, measured on the port
1364
+ rather than copied. Same corpus and gated method as above; each step is
1365
+ cumulative, so its effect is the difference from the row above. Five clean runs
1366
+ each, interleaved; the ranges of neighbouring rows do not overlap except for A.
1367
+
1368
+ | step | Gcycles | wall | Ginstr | vs base |
1369
+ |---|---|---|---|---|
1370
+ | base (the catch-up) | 68.93 | 16.78 s | 205.0 | 1.000x |
1371
+ | A: skip relative-hand conversion when ranks hold (`31802f9`) | 68.90 | 16.67 s | 203.6 | 1.000x |
1372
+ | C: trick start out of line (`31802f9`) | 68.71 | 16.61 s | 198.9 | 1.003x |
1373
+ | D: branchless hands compare (`6ebb3dd`, `67d59d5`) | 63.86 | 15.64 s | 203.1 | 1.079x |
1374
+ | E: branchless expand of a suit (`60c18a9`) | 61.66 | 14.87 s | 207.5 | 1.118x |
1375
+ | F: branchless compress of a suit (`60c18a9`) | 61.46 | 14.94 s | 207.6 | **1.122x** |
1376
+ | upstream `630705d`, clang PGO | 53.59 | 13.01 s | 166.3 | |
1377
+
1378
+ **D is the find.** `hands_include` and `hands_equal` short-circuited across four
1379
+ seats. OR-ing the per-seat differences and testing once costs 2% more
1380
+ instructions and saves 7.6% of cycles: the branches it removes mispredict, on
1381
+ the hottest path in the search (the pattern-tree scan). Upstream got the same
1382
+ effect with NEON and SSE4.1 intrinsics. Here it is plain integers, which LLVM
1383
+ can vectorise for any target, wasm included.
1384
+
1385
+ E and F likewise trade instructions for cycles: a fixed sequence of shifts and
1386
+ masks in place of loops whose branches depend on where the cards lie. Upstream
1387
+ found that trade loses about 10% on narrow cores, and keeps the loops for its
1388
+ no-SIMD wasm build. This port's wasm build is no-SIMD, so `wasm32` keeps the
1389
+ loops too.
1390
+
1391
+ Tried and dropped: B, `KeepTop` from `31802f9`. Without PDEP it loops *n* times
1392
+ where removing the bottom card loops only over the excess, and it added
1393
+ instructions. Not ported: `Pattern::Update`'s locals (Rust's borrow rules
1394
+ already give the compiler what that fixed), AVX2 (`eea0f63`) and loop alignment
1395
+ (`5306f61`). The integer form of D covers what SSE4.1 did; AVX2 would need
1396
+ `target-cpu` builds.
1397
+
1398
+ The gap to upstream on the same tree is now **1.147x**, from 1.284x. The rest
1399
+ is PGO (worth 1.7% of time on this port when last measured; see "PGO on this
1400
+ port"), and per-node work not yet traced.
1401
+
1402
+ ## Bob Salita's faster search
1403
+
1404
+ 2026-11. Bob Salita's fork of the C++ reference (`BSalita/bridge-solver`,
1405
+ branch `faster-search`, commit `b12bb3f`, on top of upstream `630705d`) changes
1406
+ the search in one commit: per-node engineering that keeps the tree, and seven
1407
+ features that change it. He reported it 1.4-1.5x faster than the reference on
1408
+ a Threadripper; here his PGO build is 1.34x faster than upstream's on cycles.
1409
+
1410
+ ### Splitting one commit into lock-step steps
1411
+
1412
+ A copy of his `solver.cc` was given a compile-time switch per tree-changing
1413
+ feature (`BS_STOPPER`, `BS_RANK`, `BS_DRAW`, `BS_MINIMIZE`, `BS_RUNS`,
1414
+ `BS_LIFT`, `BS_SECOND`), with the run-extension switch reproducing the old rule
1415
+ when off. Enabled one at a time, cumulatively, that gives a target per step,
1416
+ solved one deal per process with a counter at his `++nodes`:
1417
+
1418
+ | step | feature | nodes | |
1419
+ |---|---|---|---|
1420
+ | `bob0-base` | none | 237,671,354 | equal to `47d30f3`, deal by deal |
1421
+ | `bob1-stopper` | no-trump stopper bound (`CannotTakeAllNoTrump`) | 225,929,003 | -4.9% |
1422
+ | `bob2-rank` | trump tricks by rank (`TrumpRankTricks`) | 219,655,520 | -2.8% |
1423
+ | `bob3-draw` | draw trumps then cash | 213,908,787 | -2.6% |
1424
+ | `bob4-minimize` | fewer rank winners for fast-trick cuts | 209,988,699 | -1.8% |
1425
+ | `bob5-runs` | patterns extend only through relied-on runs | 195,173,017 | -7.1% |
1426
+ | `bob6-lift` | `LiftRunWinner` | 192,819,643 | -1.2% |
1427
+ | `bob7-second` | DDS's second-seat quick tricks | 183,796,287 | -4.7% |
1428
+
1429
+ `bob0-base` equalling upstream on every deal is what shows the switches catch
1430
+ every tree change, and that his per-node engineering keeps the tree. Every step
1431
+ gives correct tables on all 200 deals; `bob7-second` is `b12bb3f` unmodified.
1432
+ The node count is taken at `++nodes`, ahead of the second-seat test, not at
1433
+ `num_visits`, which comes after it and would miss the nodes that rule cuts --
1434
+ 2.74 million of them. The four freak tables have targets at every step too
1435
+ (`bsalita-freak-nodes.tsv`).
1436
+
1437
+ ### The port
1438
+
1439
+ Each step was ported and checked against its column; all seven match on every
1440
+ deal, and the freak tables match at `bob7-second`. Two latent bugs in the port
1441
+ surfaced, both because a new rule produced inputs no old one had:
1442
+
1443
+ - **`compute_pattern_hands`, spades only.** When one hand holds a whole suit,
1444
+ backing the bottom rank winner up past its run must leave the suit empty. The
1445
+ port saturated at index zero and kept a card, but only in spades; for other
1446
+ suits the index fell into the previous suit and was masked off. The stopper
1447
+ bound's rank winners (the tops of suits the other side holds) reached it.
1448
+ - **`Cards::slice` with `end = 64`** ignored `begin`. `LiftRunWinner` was the
1449
+ first caller to ask for "the cards below this one".
1450
+
1451
+ Both were found by logging every call of the new function in the one cell
1452
+ that differed, in both programs, and diffing the logs: the calls agreed, so the
1453
+ difference was downstream.
1454
+
1455
+ **The second-seat rule was fuzzed**, since Bob's commit says it alone was not:
1456
+ `second_seat_rule_never_changes_a_value` solves random 2- to 7-trick endings
1457
+ with the second hand to play, with and without the rule, and requires equal
1458
+ values. 2,000,000 positions, none differ; breaking the rule on purpose fails
1459
+ it at round 12. The claim checker's 1,050 benchmark claims keep every verdict,
1460
+ with 7.7% fewer nodes.
1461
+
1462
+ ### Speed
1463
+
1464
+ Single-threaded, 200 deals, M4 Pro, gated and interleaved as before:
1465
+
1466
+ | | Gcycles | wall | Ginstr | nodes |
1467
+ |---|---|---|---|---|
1468
+ | port before (the speed-only commits) | 62.12 | 15.39 s | 207.7 | 237,671,354 |
1469
+ | **port with Bob's search** | **52.95** | **13.24 s** | 178.0 | 183,796,287 |
1470
+ | upstream `630705d`, PGO (older tree) | 53.74 | 13.31 s | 166.3 | 237,671,354 |
1471
+ | Bob's `b12bb3f`, PGO | 40.16 | 9.98 s | 107.6 | 183,796,287 |
1472
+
1473
+ **1.173x on cycles.** The port is now level with upstream C++ on upstream's own
1474
+ tree. Against Bob's C++ on the same tree it is 1.318x: that is his per-node
1475
+ engineering, which reports 655 to 473 instructions a node on x86. Ported in the
1476
+ next section, without the PEXT/PDEP his bit-plane patterns lean on.
1477
+
1478
+ ## Per-node work
1479
+
1480
+ 2026-11-16. Bob's commit also makes each node cheaper without changing the
1481
+ tree, and that is what the 1.318x above was. Ported here and judged on the
1482
+ default native build and on wasm -- what users download -- rather than on
1483
+ machine-tuned ones. Each step keeps 183,796,287 nodes on the lock-step corpus
1484
+ and 577,946,152 on the freak tables, deal by deal
1485
+ (`scripts/upstream-lockstep.sh [--freak] bob7-second`). Cycles per node from
1486
+ `solver-bench cost`, the step against the one before, alternated:
1487
+
1488
+ | step | instr/node | cycles/node | |
1489
+ |---|---|---|---|
1490
+ | start (`bsalita-search`) | 968.9 | ~290 | |
1491
+ | patterns as two bit planes (`PatHands`) | 956.4 | 278.6 | freak tables 559.9 -> 510.9 |
1492
+ | `PatternVec` in 12 bytes, `ShapeEntry` one cache line | 957.8 | 280.2 | flat; freak peak memory 1.65 -> 1.40 GB |
1493
+ | node code specialised on position in trick | 866.5 | 263.0 | |
1494
+ | winning card and seat kept on each play | 852.2 | 258.9 | |
1495
+ | rank winners from two small tables | 822.4 | 244.8 | |
1496
+ | relative hands from two compress tables | 791.8 | 232.7 | freak 457.8 -> 437.1; wasm too |
1497
+ | relative hands rebuilt in full each trick | 809.3 | 227.9 | freak 455.6 -> 432.2 |
1498
+ | pattern extension without card loops | 807.9 | 224.9 | |
1499
+ | fast-trick winners in one step | 822.1 | 222.9 | |
1500
+
1501
+ Two departures from Bob's version, both for Apple Silicon and wasm:
1502
+
1503
+ - **No PEXT.** Bob numbers a pattern's cards densely across the deck with
1504
+ `pext`, which these targets lack. The planes here keep the relative-hands
1505
+ layout, each suit in its own 13 bits, which every position of a shape shares
1506
+ as well, so a position's planes are three ORs of its relative hands.
1507
+ - **Tables, not bit tricks.** Gathering a seat's cards of a suit over the suit
1508
+ (`compress_suit`) and taking a suit's top `n` cards (`top_cards`) are two
1509
+ lookups each, in 20 KB and 1.5 KB of tables, split at seven bits. Both beat
1510
+ the four-stage branchless forms natively and the bit loops upstream keeps for
1511
+ wasm. Where BMI2 is compiled in, `compress_suit` is still one `pext`.
1512
+
1513
+ Three things the instruction count got wrong, all the same way: a loop whose
1514
+ trip count is the cards' does fewer instructions and more cycles, because its
1515
+ exit mispredicts. A loop taking a suit's top `n` cards: -4.8% instructions,
1516
+ +2.5% cycles, dropped for the table. Converting all four suits at every trick
1517
+ start instead of only the changed ones: +2% instructions, -3% cycles, kept.
1518
+ Fast-trick winners by mask: +1.7% instructions, -1.0% cycles, kept. Also tried
1519
+ and dropped: skipping the recursive call into a matching pattern with no
1520
+ children (Bob does), +0.4% instructions and +0.9% cycles.
1521
+
1522
+ Gated and interleaved, five rounds, M4 Pro, single-threaded:
1523
+
1524
+ | | Gcycles | wall | Ginstr |
1525
+ |---|---|---|---|
1526
+ | port before (`bsalita-search`) | 52.84 | 13.15 s | 178.0 |
1527
+ | **port with the per-node work** | **41.07** | **10.21 s** | 151.1 |
1528
+ | Bob's `b12bb3f`, PGO, `-march=native` | 40.08 | 9.99 s | 107.6 |
1529
+
1530
+ **1.286x on cycles**, and 1.025x short of Bob's C++, which still executes 29%
1531
+ fewer instructions at lower IPC. In wasm (Node 22, the 200 analysis-benchmark
1532
+ tables) 19.1 s -> 16.3 s, 1.18x, timed alternately at a quiet moment; a later
1533
+ pair under load gave 19.8 s -> 16.6 s.
1534
+
1535
+ What is left is mostly memory: `Pattern::lookup_in` is 17% of samples, nearly
1536
+ all of it waiting on the pattern it is about to test, and `update_in` another
1537
+ 6% spread thinly over its lines. The layout is already Bob's (24 bytes of
1538
+ hands, 40 per pattern).
1539
+
1268
1540
  ## Still open
1269
1541
 
1270
1542
  - **The per-board spread** against DDS, above: 0.73x to 1.76x on the curated
@@ -1275,8 +1547,8 @@ reference's favour, not the seven that separate us.
1275
1547
  is stale at the top; `evaluate_playable_cards` and `search_with_cache` are
1276
1548
  now a larger share of a smaller total, and the next lead should be drawn
1277
1549
  from a fresh sample rather than from this table.
1278
- - **`Pattern::get_rank_winners`**, 6.5% self and never examined. It is the one
1279
- pattern-tree entry in the profile with no lead attached to it.
1550
+ - **`Pattern::get_rank_winners`**, 6.5% self here: done in "Per-node work"
1551
+ (`top_cards`, two table lookups a suit).
1280
1552
  - **`panic = "abort"`** was not tried. It would remove the unwind landing pads
1281
1553
  behind those checks, but it changes `cargo test` semantics and needs its own
1282
1554
  profile.
@@ -216,6 +216,23 @@ evidence:
216
216
  - **Treating low cards as equals** (a speed-up Adam Wildavsky described for his
217
217
  solver). It makes results inexact, so we don't. The exact equivalence is
218
218
  described next.
219
+ - **Proving a claim on a "no finesse" position first** (the swap Thorvald
220
+ Aagaard uses in BEN and Brill). Before the full search, every outstanding
221
+ card is moved above the claimer's cards, apart from the claimer's top
222
+ winners, and the swapped position is searched. Only a proof would be used,
223
+ on the reasoning that a worse position that still makes the claim makes the
224
+ real one sound. Measured on the full benchmark preset (1,050 claims):
225
+ - It proved **none** of the 14 claims that run out of budget. In 11 of them
226
+ the swapped claim is invalid, mostly within a few hundred nodes, and the
227
+ other 3 ran out of budget again at 2M. The hard claims depend on the
228
+ claimer's middle cards (length winners, tenaces), which the swap removes.
229
+ - It proved 157 of the 159 valid claims, but at about the same node count as
230
+ the full search, so it saved nothing there.
231
+ - It never proved a claim the full search calls invalid. Some reasoning
232
+ suggests it could: a high card can block a suit or be forced to win a
233
+ trick. For a defender claim, the swap also changes the cards of a partner
234
+ who is treated as an adversary. So the swap's soundness was never shown,
235
+ only not refuted.
219
236
 
220
237
  ## A bug worth remembering
221
238
 
@@ -295,8 +312,10 @@ Fixed claims, identical everywhere: `src/claim_bench.rs`.
295
312
  **Where to run it:**
296
313
  - `bridge-claim bench` runs the native tool on every core. It ships in each
297
314
  release.
298
- - [`claim-bench.html`](https://bridge-craftwork.com/bridge-solver/claim-bench)
299
- runs it in a browser, single-threaded.
315
+ - The [benchmarks page](https://bridge-craftwork.com/bridge-solver/bench.html#claims)
316
+ runs it in a browser, single-threaded, beside the analysis benchmark.
317
+ - The [claim checker page](https://bridge-craftwork.com/bridge-solver/claim.html)
318
+ checks claims on a pasted hand at any point in the play.
300
319
  - In wasm under Node, checking is about 1.4× slower than native on one thread.
301
320
  - A finished web run sends one anonymous `claimbench` record (see
302
321
  `functions/t.ts` and the privacy page), which feeds a panel on the stats page.
@@ -226,6 +226,25 @@ caches, and a freak deal — several voids, a very deep search — can take over
226
226
  gigabyte on its own. On a corpus full of those, or on a small machine, `-j 4`
227
227
  may finish where `-j 12` thrashes.
228
228
 
229
+ ## Benchmarking
230
+
231
+ `--bench` times the solver on built-in deals instead of annotating files: the
232
+ C++ reference's own 200-deal test set, the one this port is kept in lock-step
233
+ with. Each deal's full 20-cell table is solved, spread across `--threads`.
234
+
235
+ ```sh
236
+ bridge-solver --bench # all 200 deals, every core
237
+ bridge-solver --bench quick # the first 20, as the web page's Quick run
238
+ bridge-solver --bench -j 1 # one thread, to compare per-core speed
239
+ bridge-solver --bench --json # per-deal tables, nodes and times
240
+ ```
241
+
242
+ It prints nodes and solving time per tenth of the corpus, then the totals. The
243
+ tables and node counts never depend on the machine or the thread count (the full
244
+ run is always 183,796,287 nodes), so only the times should differ between two
245
+ machines. The [benchmarks page](https://bridge-craftwork.com/bridge-solver/bench.html)
246
+ runs the same deals in a browser and checks its answers against these.
247
+
229
248
  ## Bridge Composer
230
249
 
231
250
  Bridge Composer displays double-dummy analysis whenever the tags are present.
@@ -332,7 +351,7 @@ bridge-claim bench --json # every claim's verdict, nodes and time
332
351
 
333
352
  The claims are generated from fixed seeds, so every machine checks the same
334
353
  ones, and the
335
- [benchmark page](https://bridge-craftwork.com/bridge-solver/claim-bench.html)
354
+ [benchmark page](https://bridge-craftwork.com/bridge-solver/bench.html#claims)
336
355
  runs them in a browser. Verdicts (`V` valid, `X` invalid, `?` out of budget) and
337
356
  node counts never depend on the machine; if yours differ from anyone else's,
338
357
  that is a bug. Only the times should differ. `--workload`, `--sizes`, `--count`
@@ -1,5 +1,16 @@
1
1
  # Divergence fixtures
2
2
 
3
+ > **Superseded as the lock-step check (2026-11).** These fixtures, and
4
+ > `first-divergence.sh`, compare against the reference as of `75b4619`
5
+ > (2026-01-31). The port has since been brought up to upstream `47d30f3`
6
+ > (2026-10-01), which searches a different tree, so they no longer report
7
+ > `none`. Lock-step is now checked deal by deal against every upstream commit
8
+ > with `scripts/upstream-lockstep.sh COMMIT` (and `--freak COMMIT` for the
9
+ > four freak deals as full tables), from `upstream-nodes.tsv` and
10
+ > `upstream-freak-nodes.tsv`. Rebuilding the instrumented reference at
11
+ > `47d30f3` would bring these back; until then they are a record of how
12
+ > lock-step was first reached.
13
+
3
14
  Seven positions where our search does not follow the C++ reference
4
15
  (`macroxue/bridge-solver`) node for node, each one reduced to a single search
5
16
  from a cold cache.
@@ -0,0 +1,6 @@
1
+ deal bob0-base bob1-stopper bob2-rank bob3-draw bob4-minimize bob5-runs bob6-lift bob7-second
2
+ 1 65965046 64971708 64788041 64414962 63497519 57642741 56932372 52914763
3
+ 2 214561910 199924115 199909211 199590699 195901037 187082234 184534081 161227587
4
+ 3 68827378 68740131 68709931 68110683 68182907 56994794 51441359 49257211
5
+ 4 366867391 399581379 399562967 399301608 417614469 337539531 347547583 314546591
6
+ total 716221725 733217333 732970150 731417952 745195932 639259300 640455395 577946152