Skip to content

⚡ Bolt: [performance improvement] - Range solver loop array fix - #78

Open
wavehs wants to merge 1 commit into
mainfrom
bolt/solver-range-vs-range-eval-fix-17584046361040491932
Open

wavehs wants to merge 1 commit into
mainfrom
bolt/solver-range-vs-range-eval-fix-17584046361040491932

Conversation

@wavehs

@wavehs wavehs commented Jul 3, 2026

Copy link
Copy Markdown
Owner

💡 What: Fixed a critical loop bug in compute_range_vs_range_equity where the O(1) boolean tracker array (forbidden) was being accidentally overwritten by a Python set(). Removed expensive list() type constructors during evaluations and hoisted instance method lookups out of the loop.
🎯 Why: Re-assigning forbidden to a set caused TypeError: 'set' object does not support item assignment crashing range evaluations in Monte Carlo simulations, completely undoing the O(1) array check speedups and breaking functionality. Unpacking lists instead of calling list constructors minimizes allocation overheads during tight looping.
📊 Impact: Expected to fix range simulation crashes while delivering significant Monte Carlo latency reductions due to optimized object evaluations.
🔬 Measurement: Verified by running python bench_range.py which shows simulation times reduced to ~750ms for 10000 range-vs-range evaluations, bypassing crashes, and full green tests via pytest tests/test_solver.py.


PR created automatically by Jules for task 17584046361040491932 started by @wavehs

* Fixed a critical type reassignment bug in the Monte Carlo `compute_range_vs_range_equity` inner loop where `forbidden` (boolean array tracking used cards) was being overwritten by a slow `set()` on each iteration. Re-instated the O(1) tracker.
* Extracted instance method `self.evaluator.evaluate` to local variable `evaluate`.
* Removed costly `list()` constructor overheads inside the same loop.

Co-authored-by: wavehs <156133648+wavehs@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant