There are some queries (e.g., slowcomp8) which spend a large proportion of their time resolving expressions and cursors in the current context. There are a couple of relatively simple improvements:
- use the hash table more of the time. It is only problematic if a cursor is added that was already in scope
- limit the search range in the expressions.
The second could be done by having separate arrays for the different types, but the short term fix is to save the index of the last cursor, to avoid in the common case searching large numbers of expressions.