Skip to content

Conversation

@baszalmstra
Copy link
Contributor

Instead of iterating over all requires_clauses in decide(), maintain an IndexSet of variables that are assigned true and have requires clauses. This reduces the iteration scope to only relevant variables. The idea is that this can make a big difference.

Instead of iterating over all requires_clauses in decide(), maintain an
IndexSet of variables that are assigned true and have requires clauses.
This reduces the iteration scope to only relevant variables.

Key changes:
- Add active_requires_parents field to SolverState
- Add track_decision_for_requires() free function for split borrows
- Update decide() to iterate over active_requires_parents with lazy cleanup
- Use index-based iteration with in-place swap_remove for stale entries
@baszalmstra baszalmstra requested a review from wolfv November 26, 2025 19:28
@baszalmstra
Copy link
Contributor Author

I benchmarked this on my Windows Am64 machine. The results are a little underwelming.

Untitled

There doesnt seem to be a huge difference, either positive or negative. But when I looked closer to the statistics I found that some of the worst case did actually improve significantly.

Summary: 577 faster (green), 423 slower (red)
Outliers: 6 packages improved by more than 10s, 0 got worse by more than 10s

Top 5 biggest improvements:
  - r-pgirmess, bson, jinja2-simple-tags, xa | -56.64s faster
  - cykhash, mujoco-simulate, kealib, mujs,  | -50.30s faster
  - armadillo, junit5, pytango-db, dagster-p | -32.96s faster
  - blist, yosys, django-autoslug, openorb-d | -14.22s faster
  - arabic_reshaper, cufflinks-py, opensm-co | -12.06s faster

56 seconds is huge! And this is actually also visible in the first graph. The number of cases that time out went from 0.5% to 0.2%!

This graph also shows the difference better (everything is capped to +10 or -10s improvement):

Untitled

As you can see that some fast cases got faster and some got slower. But there are also a number of outliers that significantly improved.

Therefore I think this is a net improvement.

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