Commit Graph

154 Commits

Author SHA1 Message Date
Doug Gregor
8cd63c9b8d Use the constraint graph to isolate and solve the smallest connected component.
At each solution phase, construct a constraint graph and identify the
smallest connected component. Only solve for the variables in that
connected component, and restrict simplification to the constraints
within that connected component. This reduces the number of
visited-but-not-simplified constraints by ~2x when type-checking the
standard library.

Performance-wise, this is actually a regression (0.25s/8% when parsing
the standard library), because the time spent building the constraint
graph exceeds the time saved by the optimization above.

The hackaround in the standard library is due to
<rdar://problem/15168483>. Essentially, this commit changes the order
in which we visit type variables, causing the type checker to make
some very poor deduction choices.

The point of actually committing this is that it validates the
constraint graph construction and sets the stage for an actual
optimization based on isolating the solving work for the different
components.



Swift SVN r10672
2013-11-23 03:44:40 +00:00
Doug Gregor
5d9b955369 Overload-binding constraints can have base types; add those adjacencies.
Swift SVN r10665
2013-11-22 22:11:52 +00:00
Doug Gregor
e28c425a64 Compute connected components for the constraint graph.
This implements an offline algorithm for connected components. We
could use an online algorithm, which would be slightly more efficient
in the case where we always require the connected components, but such
algorithms don't cope with edge removals very well.

Still just a debugging tool!



Swift SVN r10663
2013-11-22 19:21:43 +00:00
Doug Gregor
ccf01377cc Introduce a constraint graph to track relationships among type variables.
We're not using this for anything other than debugging at the moment.


Swift SVN r10661
2013-11-22 18:25:14 +00:00