typechecker: Perform type family consistency checks in topological order
Consider a module M importing modules A, B and C. We can waste a lot of work depending on the order that the modules are checked for family consistency. Consider that C imports A and B. When compiling C we must have already checked A and B for consistency, therefore if C is processed first then A and B will not need to be checked for consistency again. If A and B are compared first, then the consistency checks will be performed against (wasted as we already performed them for C). At the moment the order which modules are checked is non-deterministic. Clearly we should engineer that C is checked before B and A, but by what scheme? A simple one is to observe that if a module M is in the transitive closure of X then the size of the consistent family set of M is less than or equal to size of the consistent family set of X. Therefore by sorting the imports by the size of the consistent family set and processing the largest first, you make sure to process modules in topological order. In practice we have observed that this strategy has reduced the amount of consistency checks performed. One solution to #25554
parent
67b62a75
No related branches found
No related tags found
Pipeline #104398 passed
Stage: tool-lint
Stage: quick-build
Stage: full-build
Stage: packaging
Stage: testing
Please register or sign in to comment