Speed up compiling many nested subqueries
Speed up compiling many nested subqueries

I ran into this after https://github.com/cloudera/ibis/pull/901 . When
you have queries that have many levels of subqueries the compiling
time starts to increase drastically. By caching the graph traversal,
the compile time is decreased.    This includes the mentioned pr
https://github.com/cloudera/ibis/pull/901 . I can merge this into that
pr if that makes more sense. I figured it might be helpful to split
the bug fix up from the improvement.    ```python  # example_fail.py
import ibis    def add_filter_and_ana(t):      t = t[t.columns +
[ibis.null().name('filter')]]        t = t[t['filter'].isnull()]
t = t[['col']]        t = t[t.columns + [t.count().name('analytic')]]
t = t[t.columns]      t = t[t['analytic'] < 0]      t = t[['col']]
return t    t = ibis.table((('col', 'int32'), ), name='t')    for _ in
range(4):      t = add_filter_and_ana(t)    ibis.impala.compile(t)
```    ```  root@582f1eb935bd:/ibis/ibis# git checkout fix-analytic-
projection  Already on 'fix-analytic-projection'  Your branch is up-
to-date with 'origin/fix-analytic-projection'.
root@582f1eb935bd:/ibis/ibis# time python example_fail.py
real    0m10.935s  user    0m10.828s  sys     0m0.096s
root@582f1eb935bd:/ibis/ibis# git checkout fast-visit  Switched to
branch 'fast-visit'  root@582f1eb935bd:/ibis/ibis# time python
example_fail.py    real    0m0.535s  user    0m0.456s  sys
0m0.072s  ```

Author: Max Mizikar <maxmzkr@deepfield.net>

Closes #902 from maxmzkr/fast-visit and squashes the following commits:

acc01d0 [Max Mizikar] Make lines shorter than 80 characters
dba29c4 [Max Mizikar] Remove extra line
2816bca [Max Mizikar] Speed up many levels of queries

deepfield/ibis,cpcloud/ibis,deepfield/ibis,cloudera/ibis,ibis-project/ibis,cpcloud/ibis,ibis-project/ibis,cpcloud/ibis,wesm/ibis,ibis-project/ibis,deepfield/ibis,wesm/ibis,deepfield/ibis,cpcloud/ibis,cloudera/ibis,wesm/ibis,ibis-project/ibis,cloudera/ibis