-
Notifications
You must be signed in to change notification settings - Fork 0
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
Optimising Rewrite Performance #19
Comments
The latest version of the algorithm in question I can find is in This is not the implementation used in I think the main thing this algorithm does is:
|
Strategies for improving performance using incremental algorithms:
To fully implement (1) it would probably help if the |
What's the goal?
|
These optimisations are based on those used in v0.3.36. They are still relatively simple but focus on reducing the amount of memory needlessly allocated during reductions. They still traverse the entire automaton after every reduction though, which is wasteful.
Continuing to think about incrementalisation. What are we trying to achieve?
The question is: how to address these requirements. Some obvious ideas:
Another important consideration is to maintain information across reduction / inferences. At the moment, all information is destroyed once a reduction is completed, etc. Also, should not forget the cost of adding a new vertex to the automaton, etc. |
A little bit of instrumentation has proved to be quite interesting. In particular, here are the three things I instrumented:
Overall, the results indicates the time spent rewriting significantly dwarfs the time spent on the other two aspects. This raises the question as to which aspect of rewriting is expensive? There are a couple of hypotheses:
... I guess we'd better find out which it is! |
A few things. Firstly, a large amount of time is spent in the method NOTE: the |
UPDATE: commenting out UPDATE: The version of |
Have identified the call to Automaton.minimise() from within the Automaton.rewrite() method as a *major* time sink. I'm not sure why this call is needed, though things definitely do not work without it.
Right, so here is the minimal test case which illustrates why minimisation is necessary after rewriting: G = { 1->2, 3->4 } Rewrite 2 => 4 In this case, we now need to merge
I guess this leaves open a few questions as to how best to proceed. |
What we really want is an efficient incremental minimisation algorithm. Some notes:
We could simulate (1) in order to test whether or not it works. |
This is the initial (and incomplete) implementation of the incremental algorithm for efficient automaton minimisation during rewriting.
These updates have put in place a significant amount of the machinery required for the incremental algorithm. However, this is not finished and it's not entirely clear whether it is even correct per se.
Some methods in the incremental automaton minimiser needed more explanation! Some still do ...
The incremental minimiser is about ready to be tested. It is definitely not working as efficiently as I would like at this stage, but I have maximised the reuse of existing automata code. This is just to increase the likelyhood of success! To begin testing it, I need to plumb it into the Reducer somehow so that Reduction rules no longer call "minimise", and that the incremental minimiser is called instead.
The incremental minimiser was eliminated too many states in some cases. In particular, it should never be eliminating a state which is also a root!
On the issue of incremental rewriting performance:
|
For now, this is pretty much gone as far as possible. #28 takes over from here. There are probably some outstanding bugs to fix, so we'll see whether that takes us. |
In exploring #18, an important discovery was made:
In fact, in exploring the substitution approach versus the rewrite-based approach to handling inferences, it had become apparent to me that this would be especially true. However, the very surprising verification performance of Whiley
v0.3.36
appears to stem specifically from the use of an incremental algorithm. One which, unfortunately, was removed at some point for reasons unknown.Therefore, the goal of this issue is to reconsider the incremental approach in the context of the new Rewriter API.
The text was updated successfully, but these errors were encountered: