-
Notifications
You must be signed in to change notification settings - Fork 21
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
Don't use vmcast to convert the reified goal and actual goal #134
Conversation
With this PR: From Coq Require ZArith.
From AAC_tactics Require Import AAC.
From AAC_tactics Require Instances.
Import ZArith.
Import Instances.Z.
Fixpoint mkevil n := match n with 0%nat => 1 | S k => 2 * mkevil k end.
(* 2 ^ n in Z *)
Definition evil := mkevil 1000%nat.
(* Time Eval vm_compute in evil. *)
(* 0.08s *)
Lemma test a : a + evil = evil + a.
Proof.
Time aac_reflexivity.
(* 0.9s *)
Time Qed.
(* 0.01s *) , without it Qed takes an unknow but very long time ( |
@SkySkimmer : FYI: I am working on a solution, where also the tactic application time is quite fast (a few ms) - but it is a more invasive change. |
@SkySkimmer : I had a look at the slowness in your example and is type class resolution:
Adding
fixes this. It still would make sense to do a full compute in the I profiled the two example files without and with your change and there is no difference:
@palmskog : IMHO the fix of @SkySkimmer is OK, except that the other occurance of VMcast should also be replaced. The above tests are with both replaced. |
I now did a performance test with larger terms. The short summary is that one doesn't need to worry much because AAC tactics apparently has rather bad run time behaviour. It seems to rise exponentially with base 3 with variable / operator count. The tactic run time is about the same for master and this PR (with both VMcast changed). The QED time is faster in master. The solution in this branch takes about the same time for tactic run time and QED, which I find reasonable to prevent uncontrolled blow up in other places. And as I said - for the examples provided there is no difference. Here is the test:
|
@MSoegtropIMC so what is the verdict or bottom line? Will this PR improve current |
@palmskog : IMHO this PR should be merged (with the other cast changed as well). It makes complicated use cases 2x slower but some simple use cases close to infinitely faster. IMHO this is a good compromise since apparently this tactic is anyway not terribly useful for complicated cases (ring does this in a flash). @SkySkimmer : can you please change the other I have ideas which might make this faster (both tactic execution and QED time), but I think we should merge this PR anyway. |
VM can't avoid computing subterms of the goal that should be left alone. Fix coq-community#133
changed |
@MSoegtropIMC it would be useful to have all your performance tests available in the repository. Any chance you could submit them as a PR? For example, you could put them under a directory |
@palmskog : sure, I planned to do this - still wrapping my head around making it faster. In case this doesn't work out, I will do a PR just for the performance tests. Btw.: do you have the impression that there is a robust test suite? I have the impression that there is quite a bit of not neccessary code - I can remove > 50% of the code of some tactics and they still do the same. I am not sure if this is to hack around issues in old versions of Coq which have been fixed meanwhile or for exotic uses cases. |
@MSoegtropIMC I've only worked with some small parts of the OCaml code, there could indeed be many gains by refactoring. Most of the "tests" are right now at the Coq level ( |
VM can't avoid computing subterms of the goal that should be left alone.
Fix #133