Skip to content

Speed up stateful testing with many rules#4746

Merged
Zac-HD merged 1 commit into
HypothesisWorks:masterfrom
Zac-HD:claude/trusting-edison-LxbCL
May 27, 2026
Merged

Speed up stateful testing with many rules#4746
Zac-HD merged 1 commit into
HypothesisWorks:masterfrom
Zac-HD:claude/trusting-edison-LxbCL

Conversation

@Zac-HD
Copy link
Copy Markdown
Member

@Zac-HD Zac-HD commented May 27, 2026

Selecting which rule to run next repeated work that scales with the number of rules on every step - most notably recomputing the uncached label of the rule-selection strategy, which was rebuilt from scratch each step. Reuse a single filtered strategy across steps, and cache the per-class setup (sorting the rules and building the underlying strategy) so it runs once per class rather than each time the machine is instantiated.

Closes #4465; while derandomize gives us different workloads per n_rules the trend is pretty clear:

n_rules old_time (s) new_time (s) speedup
10 0.960 0.800 1.20x
50 1.924 1.732 1.11x
100 3.706 3.465 1.07x
500 1.421 1.056 1.35x
2000 3.146 2.218 1.42x
5000 4.203 1.403 3.00x

Selecting which rule to run next repeated work that scales with the number of
rules on every step - most notably recomputing the uncached label of the
rule-selection strategy, which was rebuilt from scratch each step. Reuse a
single filtered strategy across steps, and cache the per-class setup (sorting
the rules and building the underlying strategy) so it runs once per class
rather than each time the machine is instantiated.

https://claude.ai/code/session_01AnXgxUP11ftXiFNH8wXATk
@Zac-HD Zac-HD enabled auto-merge May 27, 2026 02:48
@Zac-HD Zac-HD merged commit 2dac8e0 into HypothesisWorks:master May 27, 2026
150 of 153 checks passed
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.

performance of run_state_machine_as_test drops drastically as a function of the number of state machine rules

3 participants