Comment 3 for bug 2025030

Revision history for this message
John Johansen (jjohansen) wrote :

Yes, this is to be expected. The dfa build algorithm can have exponential state explosive. Expr simplification is a technique to help avoid/mitigate that from happening. There is no reason that expr simplification shouldn't be done.

In the past Jamie had disabled it for a couple of reasons.

1. for very simple profiles it isn't needed, and causes compilation to slow down a little, vs. not having it. (this was on click, with phones slow processor).

2. expr simplification could in its own rights in the past could be pathalogical as it makes multiple passes, working on simplifying expressions to deal with this explosion issue. In these cases, while it would reduce memory overhead of the compile it would slow down the compile significantly.

Case 2 was taken care of but putting a hard cap on the number of passes simplification will do, in upstream commit

2809060be parser: limit the number of passes expr tree simplification does (MR: https://gitlab.com/apparmor/apparmor/merge_requests/246)

This was found to achieve the majority of simplification gains without multiple passes where as few as a single change was made. And there is of course MR 711 that mvo has already brought up. There is some other work that will further improve expr simplification when it lands, so we should see further performance improvements in the future.