Algorithm Performance
compat-finder currently ships with two built-in algorithms: binary-split and leave-one-out.
Here, "performance" mainly means how many test rounds the troubleshooting flow needs.
TL;DR
- In almost all cases,
leave-one-outuses exactlynquestions; it becomesn + 1only when the final result covers all targets. binary-splitvaries with the size and distribution of the final result set and usually falls between aboutmax(1, ceil(log2(n)))and2n - 1questions.
| Observation | Condition | Better Choice |
|---|---|---|
| Average question count | Final incompatible set is about 22.84% to 100% of the total target set | leave-one-out |
| Average question count | Final incompatible set is below 22.83% | binary-split |
The crossover point is around 13.77%; below that, in most cases, the worst case for binary-split is also better than leave-one-out.
Conclusion: binary-split remains the default because, in real troubleshooting, problematic targets are usually a minority.
How to Choose
- You expect to end up with only a few incompatible targets: prefer
binary-split - You expect to end up with many incompatible targets: consider
leave-one-out - You are unsure: start with the default
binary-split - You want to see how to switch algorithms in practice: continue with CLI and API Reference
Overall Trend
The chart below summarizes the overall behavior across all non-empty result sets.
When the Final Result Has Only 1 Target
Single-target cases are one of the clearest situations where binary-split wins.
When the Final Result Set Is Small
At 12.5% of the total target set, binary-split has a clear advantage.
Near the Worst-Case Crossover
Around 13.77%, the worst-case behavior of the two algorithms starts to get close.
Near the Average-Case Crossover
Around 22.83%, the average-case advantage starts to flip.
When the Incompatible Set Is Large
When the final result is close to "almost everything is incompatible," leave-one-out becomes more consistent and often uses fewer rounds.