-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type checking times again! #3246
Comments
I can now confirm that the program eventually fails to type check. But it takes about 5 hours (14 hours on my laptop) to do so! What is going on here? |
I think issue is the same as #172 which is that the Idris type checker does complete normalization instead of just to whnf-form. I am unsure if there is a particular satisfying workaround for your current issue. It would probably take less time if there were less terms in pre-order syntax reasoning, but that affects readability. |
You are probably right but there might be something more than #172 (or #3199) at stake here. The facts look like the following: type checking the base case and
takes about 2 minutes to succeed. Type checking the base case and
takes about two minutes to fail. Here, the error message is
suggesting that something strange might be happening. Type checking the base case and
also fails in about two minutes and with the same error message. Even
fails to type check in only about 4 minutes and, again, with the same error message! It is only when one tries to type check the base case with
that type checking times start to diverge to values of the order of hours. At this point, freezing However, the base case with
fails to type check (again, with frozen
Here, it seems that the type checker is using a wrong version of |
The |
I do not know either but replacing
with
makes the
error disappear. We are now left with the second error (and with the problem of understanding why the type of |
You are probably right! The code
type checks in about 20 seconds. But commenting out
increases the type checking time to hours! It will be interesting to see whether type checking based on whnf-form will make it possible to type in reasonable times and without having to introduce ad-hoc |
I've been playing around with WHNF, and it's not actually clear to me now that it's always going to be a win in practice. Even here, it would end up having to reduce fromFraction to get at the relevant head, and it's clear from the %freeze that unification can make progress even avoiding that. I'm reading around what other systems do - there must be a good strategy lurking somewhere. |
Thanks Edwin! I am going to post a self-contained example that exhibits a similar behavior. Best, Nicola |
As an update, I have found the cause of recent slow downs, which is to do with partial evaluation doing too much work. I'll aim to fix this later this week, but in the meantime you can probably get much better (compile time) performance with |
@edwinb Maybe it's a good time to consider having multiple optimization levels? |
@ahmadsalim we already do, in a sense, but that's nothing to do with the problem here. The partial evaluator does too much work and that is a bug (it's repeating work it's done before), not a failure in setting the right optimisation levels. |
@edwinb Hmm ... I do not see improvements with the
This is with Idris-dev-ff776da which I'm sticking to essentially because of #3405. Is it possible that |
I ran into another example which takes ages to type check. Here's the code
On a fresh installation of https://github.com/nicolabotta/SeqDecProbs, you should be able to just do
On a reasonably fast processor (Xeon E5-2667 v3 8C, 3.2GHz) it should take a few minutes to type check the dependencies of
TestTypeCheckingSpeed.lidr
and more than ... one hour to (fail to?) type checkTestTypeCheckingSpeed.lidr
itself!I am not sure that this problem is an instance of #3199. I have tried to prevent expanding features by a careful use of
%freeze
directives with no success.There must be something pathological in the example above. But, generally speaking, I have the impression that type checking proofs of properties of specific
Num
implementations has become very time consuming lately.Again, I have not done any systematic attempt at finding out whether this is a regression (as I did for #3209) but I have the impression that type checking times have worsened over the last weeks. I might be wrong, of course.
Any idea how to get back to acceptable type checking times? This having to wait for hours is starting to become a bit annoying!
The text was updated successfully, but these errors were encountered: