Fix n² complexity in cfkey

The optimizer has a helper that checks statements for equality, cfkey.  It is currently n², and could be made linear by memoization.
let's just fold this function into its single use -- replace the call to clear_cfkey_cache() with just cfkey_cache = {}
LGTM to land once this is done