Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Conditional optimization: true || x == true, false && y == false, etc. #6105
There are four key optimizations that Mondrian's optimizer could make but doesn't.
Mondrian's optimizer is smart enough to turn
However, Mondrian's optimizer misses several key first-order optimizations that are quite useful.
Unfortunately, you have to be careful with the two remaining cases unless you can prove that
This is something that is pretty easy to encounter in performance-critical cases where you don't really want to have to rely on the JIT optimizer to be smart enough.
One would hope that the optimizer would actually be smart enough to recurse through boolean expressions and apply these transformations from the outside in. There are also some additional safe transformations like
Imported From: https://issues.scala-lang.org/browse/SI-6105?orig=1
Sources at branch: https://github.com/magarciaEPFL/scala/tree/GenBCodeOpt