Make it possible to limit how many times the syntactic equality shortcut is allowed to fail #5801
Labels
documented-in-changelog
Issues already documented in the CHANGELOG
performance
Slow type checking, interaction, compilation or execution of Agda programs
type: enhancement
Issues and pull requests about possible improvements
Milestone
Agda's syntactic equality shortcut is employed recursively (unless
--no-syntactic-equality
is used). In the implementation of smalltt @AndrasKovacs takes a different approach:One can make Agda very slow by unifying two big terms that are almost syntactically identical, in the following way:
The time required to type-check the final definition seems to be at least quadratic in
n
, but roughly linear if--no-syntactic-equality
is used (according to--profile=definitions
).I tried to implement something that resembles the approach taken by smalltt: in my implementation
checkSyntacticEquality
had two continuations, one for success and one for failure, and syntactic equality checking was turned off in the failure continuation. This worked fine for the code above, but led to a substantial slowdown for the standard library. Thus I'm leaning towards making the number of allowed failures configurable, following a suggestion by @AndrasKovacs.The text was updated successfully, but these errors were encountered: