minor eager prefixes improvements

- count eager prefixes as always run engine when comparing with smwr
 - only check if a prefix is vacuous after adding back literal fragments
This commit is contained in:
Alex Coyte 2016-07-12 14:01:51 +10:00 committed by Matthew Barr
parent e95a251935
commit 981b59fd05
2 changed files with 9 additions and 3 deletions

View File

@ -1274,9 +1274,6 @@ bool checkSuitableForEager(bool is_prefix, const left_id &left,
if (proper_out_degree(g.startDs, g)) { if (proper_out_degree(g.startDs, g)) {
return false; /* not purely anchored */ return false; /* not purely anchored */
} }
if (is_match_vertex(g.start, g)) {
return false; /* vacuous (todo: handle?) */
}
ei.new_graph = cloneHolder(*left.graph()); ei.new_graph = cloneHolder(*left.graph());
auto gg = ei.new_graph; auto gg = ei.new_graph;
@ -1284,6 +1281,10 @@ bool checkSuitableForEager(bool is_prefix, const left_id &left,
ei.lag_adjust = decreaseLag(build, *gg, succs); ei.lag_adjust = decreaseLag(build, *gg, succs);
if (is_match_vertex(gg->start, *gg)) {
return false; /* should not still be vacuous as lag decreased */
}
if (!can_die_early(*gg, EAGER_DIE_BEFORE_LIMIT)) { if (!can_die_early(*gg, EAGER_DIE_BEFORE_LIMIT)) {
DEBUG_PRINTF("not eager as stuck alive\n"); DEBUG_PRINTF("not eager as stuck alive\n");
return false; return false;

View File

@ -1234,6 +1234,11 @@ u32 roseQuality(const RoseEngine *t) {
always_run++; always_run++;
} }
if (t->eagerIterOffset) {
/* eager prefixes are always run */
always_run++;
}
const HWLM *ftable = getFLiteralMatcher(t); const HWLM *ftable = getFLiteralMatcher(t);
if (ftable) { if (ftable) {
/* TODO: ignore conditional ftables, or ftables beyond smwr region */ /* TODO: ignore conditional ftables, or ftables beyond smwr region */