Added length heuristic to set matching

Now the last set variable is treated differently.
Speed-up is 5-10x compared to interpreter version.