

def main(numpreds=100, numdocs=2000, printp=0):
    preds = gen_predicates(numpreds)
    docs = gen_docs(numdocs)
    s1 = make_set(preds)
    s2 = make_set_optimized(preds)
    if printp:
        print('Predicates:')
        for p in preds:
            print('\t', p.predicate)
    start = time.time()
    total = 0
    for d in docs:
        total += len(s1.evaluate(d))
    end = time.time()
    print(('(Naive) Evaluated %d docs across %d predicates in %0.3f seconds' % (numdocs, numpreds, (end - start))))
    print(('(Naive) Total of %d predicates matched' % total))
    start = time.time()
    total_o = 0
    for d in docs:
        total_o += len(s2.evaluate(d))
    end = time.time()
    print(('(Opt) Evaluated %d docs across %d predicates in %0.3f seconds' % (numdocs, numpreds, (end - start))))
    print(('(Opt) Total of %d predicates matched' % total_o))
    if (preds != total_o):
        print('Mismatch! Differing inputs:')
        for d in docs:
            r1 = s1.evaluate(d)
            r2 = s2.evaluate(d)
            if (r1 != r2):
                print('Input:', repr(d))
                print('Naive:')
                for p in r1:
                    print('\t', p.predicate)
                print('Opt:')
                for p in r2:
                    print('\t', p.predicate)
                print()
        sys.exit(1)

dataset/ETHPy150Open armon/pypred/bench.py main/VarMisuse@214/341 `total`->`preds`