Use a bitmap for the rule queue. Many small optimizations.