Skip to content

Commit

Permalink
Parmatch.matrix_stable_vars: optimize the all-negative case
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Jan 3, 2018
1 parent 801a2d5 commit a10bff1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions typing/parmatch.ml
Expand Up @@ -2366,6 +2366,11 @@ let rec matrix_stable_vars m = match m with
(* The stable variables are those stable at any position *)
Vars (List.fold_left IdSet.union IdSet.empty stables_in_varsets)
end
| m when List.for_all (function Negative _ -> true | Positive _ -> false) m ->
(* optimization: if m has many negative cases and few positive cases
(a small guarded clause after a long list of clauses), many sub-matrices
may have no positives at all; quit early in this case *)
All
| m ->
let m = simplify_first_amb_col m in
if not (all_coherent (first_column m))
Expand Down

0 comments on commit a10bff1

Please sign in to comment.