This PR introduces an alternative construction for `DecidableEq` instances that avoids the quadratic overhead of the default construction. The usual construction uses a `match` statement that looks at each pair of constructors, and thus is necessarily quadratic in size. For inductive data type with dozens of constructors or more, this quickly becomes slow to process. The new construction first compares the constructor tags (using the `.ctorIdx` introduced in #9951), and handles the case of a differing constructor tag quickly. If the constructor tags match, it uses the per-constructor-eliminators (#9952) to create a linear-size instance. It does so by creating a custom “matcher” for a parallel match on the data types and the `h : x1.ctorIdx = x2.ctorIdx` assumption; this behaves (and delaborates) like a normal `match` statement, but is implemented in a bespoke way. This same-constructor-matcher will be useful for implementing other instances as well. The new construction produces less efficient code at the moment, so we use it only for inductive types with 10 or more constructors by default. The option `deriving.decEq.linear_construction_threshold` can be used to adjust the threshold; set it to 0 to always use the new construction. |
||
|---|---|---|
| .. | ||
| forthelean | ||
| parser | ||
| pldi | ||
| webserver | ||
| .gitignore | ||
| add_zeros.lean | ||
| arith_eval_nat.lean | ||
| arith_eval_uint32.lean | ||
| badreset.lean | ||
| badupdate1.lean | ||
| bigctorfields.lean | ||
| bool_exhaust_test.lean | ||
| cmdparsertest1.lean | ||
| compile.sh | ||
| deriving.lean | ||
| dir.lean | ||
| DiscrTree.lean | ||
| environment_extension.lean | ||
| envtest.lean | ||
| eval.lean | ||
| eval2.lean | ||
| expander.lean | ||
| file.lean | ||
| filemap.lean | ||
| fix.lean | ||
| fix1.lean | ||
| flat_parser.lean | ||
| flat_parser2.lean | ||
| forIn.lean | ||
| forIn2.lean | ||
| frontend1.lean | ||
| gen.lean | ||
| hash.lean | ||
| hashable.lean | ||
| ir.lean | ||
| lazylist.lean | ||
| levelparsertest1.lean | ||
| lowtech_expander.lean | ||
| map_perf.lean | ||
| mapVShmap.lean | ||
| matchEqs.lean | ||
| moddata.lean | ||
| modtest1.lean | ||
| nnf.lean | ||
| noConfusionDecEqExp.lean | ||
| oldcompile.sh | ||
| oldrun.sh | ||
| opts.lean | ||
| parser1.lean | ||
| parser2.lean | ||
| partial_eq_lemma.lean | ||
| patch.lean | ||
| patcheqnspace.lean | ||
| patcheqnspace2.lean | ||
| perf.lean | ||
| persistentarray.lean | ||
| pge.lean | ||
| phashmap.lean | ||
| primes.hs | ||
| qsort64.lean | ||
| rand.lean | ||
| reelab.lean | ||
| ref2.lean | ||
| run.sh | ||
| seq1.lean | ||
| seq2.lean | ||
| simp_binders.lean | ||
| simpleTypes.lean | ||
| sizeof1.lean | ||
| sizeof2.lean | ||
| sizeof3.lean | ||
| sleep_save.lean | ||
| smap.lean | ||
| som.lean | ||
| split.lean | ||
| task_test.lean | ||
| task_test2.lean | ||
| task_test3.lean | ||
| task_test4.lean | ||
| termParserAttr.lean | ||
| termparsertest1.lean | ||
| tst.lean | ||
| uf1.lean | ||
| uf1_new.lean | ||
| unsafe.lean | ||
| usizeBug.lean | ||
| view_expander.lean | ||