Minor bugfix: the bad constant heuristic was missing some things.
Minor optimization: cache result of .equals calls.
This doesn't seem to make much of a difference most of the time, but in theory it can greatly reduce the amount of duplicated work I do.