3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-11 05:30:51 +00:00

add alternate caching mechanism to allow experimenting for #4747

@nunoplopes @aqjune you can experiment by setting ALIVE_OPT to 1 and see if this helps.
A further possible optimization is to persist the "subst" object on the api_context object.
Then in Z3_substitute in api_ast.cpp, instead of declaring locally
        expr_safe_replace subst(m);
you can use an attribute on the context to retrieve the same substitution object.

It is not easy to figure out if this matters without having some profiling information so I hope you can determine on your side whether this is useful.
This commit is contained in:
Nikolaj Bjorner 2020-10-26 11:49:24 -07:00
parent 8d76470a8a
commit 3ba857fb04
2 changed files with 41 additions and 12 deletions

View file

@ -28,9 +28,12 @@ class expr_safe_replace {
expr_ref_vector m_src;
expr_ref_vector m_dst;
obj_map<expr, expr*> m_subst;
obj_map<expr,expr*> m_cache;
ptr_vector<expr> m_todo, m_args;
expr_ref_vector m_refs;
obj_map<expr,expr*> m_cache;
void cache_insert(expr* a, expr* b);
expr* cache_find(expr* a);
public:
expr_safe_replace(ast_manager& m): m(m), m_src(m), m_dst(m), m_refs(m) {}