mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
cache datatype util in context to avoid performance bug, codeplex issue 195
Signed-off-by: Nikolaj Bjorner <nbjorner@hotmail.com>
This commit is contained in:
parent
3c5897eea0
commit
86ac20faf6
|
@ -1,10 +1,28 @@
|
||||||
#include<vector>
|
#include<vector>
|
||||||
#include"z3++.h"
|
#include"z3++.h"
|
||||||
|
#include<strstream>
|
||||||
|
|
||||||
using namespace z3;
|
using namespace z3;
|
||||||
|
|
||||||
|
|
||||||
|
void slow() {
|
||||||
|
context ctx;
|
||||||
|
unsigned sortSize = 200000;
|
||||||
|
char** names = new char*[sortSize];
|
||||||
|
func_decl_vector enum_consts(ctx);
|
||||||
|
func_decl_vector enum_testers(ctx);
|
||||||
|
for (unsigned i = 0; i < sortSize; ++i) {
|
||||||
|
std::stringstream strm;
|
||||||
|
strm << "c" << i;
|
||||||
|
names[i] = strdup(strm.str().c_str());
|
||||||
|
}
|
||||||
|
sort s = ctx.enumeration_sort("enumT", sortSize, names, enum_consts, enum_testers);
|
||||||
|
std::vector<Z3_func_decl> decls;
|
||||||
|
for (unsigned i = 0; i < sortSize; ++i) {
|
||||||
|
decls.push_back(Z3_get_datatype_sort_constructor(ctx, s, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Demonstration of how Z3 can be used to prove validity of
|
Demonstration of how Z3 can be used to prove validity of
|
||||||
De Morgan's Duality Law: {e not(x and y) <-> (not x) or ( not y) }
|
De Morgan's Duality Law: {e not(x and y) <-> (not x) or ( not y) }
|
||||||
|
@ -986,6 +1004,8 @@ void extract_example() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
slow();
|
||||||
|
return 0;
|
||||||
try {
|
try {
|
||||||
demorgan(); std::cout << "\n";
|
demorgan(); std::cout << "\n";
|
||||||
find_model_example1(); std::cout << "\n";
|
find_model_example1(); std::cout << "\n";
|
||||||
|
|
Loading…
Reference in a new issue