Skip to content

Commit dadfbf0

Browse files
committed
dfa: fix approximate cache size
Unbelievably, this was using the size of the compiled prog *and* the heap memory used by the cache to compute the total memory used by the cache. The effect of this is that the reported size might be much bigger than what is actually used by the cache. This in turn would result in the lazy DFA thrashing the cache and going quite slow.
1 parent 0ff592e commit dadfbf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dfa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ impl<'a> Fsm<'a> {
15761576
/// inputs, a new state could be created for every byte of input. (This is
15771577
/// bad for memory use, so we bound it with a cache.)
15781578
fn approximate_size(&self) -> usize {
1579-
self.cache.size + self.prog.approximate_size()
1579+
self.cache.size
15801580
}
15811581
}
15821582

0 commit comments

Comments
 (0)