use of suite.os.Stopwatch in project suite by stupidsing.
the class SewingProverTest method testPerformance.
@Test
public void testPerformance() {
RuleSet rs = Suite.newRuleSet();
Atom pred = Atom.of("q");
Atom tail = Atom.NIL;
for (int i = 0; i < 65536; i++) rs.addRule(Rule.of(Tree.of(TermOp.IS____, Tree.of(TermOp.TUPLE_, pred, Int.of(i)), tail)));
ProverFactory sp = new SewingProverImpl(rs);
ProverConfig pc = new ProverConfig(rs);
Prove_ test = sp.prover(Suite.parse("q 32768"));
Source<Stopwatch<Boolean>> trial = () -> Stopwatch.of(() -> {
boolean isOk = true;
for (int i = 0; i < 65536; i++) isOk &= test.test(pc);
assertTrue(isOk);
return isOk;
});
for (int i = 0; i < 8; i++) trial.source();
Stopwatch<Boolean> sw = trial.source();
System.out.println(sw.duration);
assertTrue(sw.duration < 300);
}
Aggregations