-
Notifications
You must be signed in to change notification settings - Fork 27
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
OSS: extremely bad replaceKnown performance #3248
Comments
Thanks for investigating. A number of years back, we had once investigated this issue, and I confirm your observation: The majority of time is spent (wasted?) on equality treatment. There were a few suggestions to change the treatment then. One plan was to set up a set of left-hand-sides of equations and only check for newly introduced terms if they occur in this set. Trigger a rule application then. For some reason the implementation turned out not to be faster. But I still believe it should have been faster. I'd be happy if we could revisit this issue. |
This is the hash code used for the map: key/key.core/src/main/java/de/uka/ilkd/key/rule/OneStepSimplifier.java Lines 735 to 739 in cacc0fb
I think performance can be improved by adding more data to the hash code. For example the term depth must also be equal (I believe): @Override
public int hashCode() {
return Objects.hash(term.op(), term.depth());
} |
I don't think that this coarse hash code scheme is the problem. I replaced it with the hashing function in https://gist.github.com/mattulbrich/28c0f53f5a9f608c8c86f2ab1da39546, and it produced proofs of almost the same runtime (and same number of rule apps). I am not fully sure how it works, but Richard's compiled taclet matcher may be an efficient alternative to checking all subterms with a hashtable ... /cc @unp1 |
I do think it has a big impact, at least in some situations. Your proposed hash is much slower (mine: 282 seconds for 100% replay, yours: 360 seconds for 19% of the replay). |
Ok, that obviously depends on the program to load. I apparently looked at a smaler program. Which example do you use for reference? |
While you are at it: The treatment of equalities ( |
I use https://gist.github.com/FliegendeWurst/9be15e20e3bfd0722fcdd7f5c4afebcd. It requires some of my changes in https://github.com/FliegendeWurst/key/tree/testing, most notably the support for |
Regarding selectOfStore etc. Christoph Scheben implemented a set of
taclets which pull out common heap terms such that such select-store
chains need not be reduced more than once. It may be that adding taclets
to the OSS may render these techniques useless.
It may be that nowadays using the OSS is the faster solution, but that
should be looked at. Perhaps some other rules of this techniques would
then better be removed.
|
I have done some more tests on ShortestPath.java:
I ran the macros Finish Symbolic Execution and Heap Simplification in each configuration (rule app count above is after executing each macro). |
Description
Automated proof search, replaceKnown accounts for 43% of all CPU time: (the view below is zoomed in)
As far as I can tell, almost no replace_known_left / right rules were actually applied.
Reproducible
always
Steps to reproduce
I can provide the Java file if needed.
Expected behaviour: acceptable performance, KeY spends CPU time on useful stuff
Actual behaviour: performance gets worse as the proof grows, KeY wastes half its CPU time
Additional information
I should mention that I modified the Simplifier to consider more rulesets.
The text was updated successfully, but these errors were encountered: