Big optimization

This one line change took about 25% of the time for dsres translation.
I'm sure the reason is that we had to check whether a given signal
was in a list.  By changing the list to a set, the search was much
faster.

There could be similar potential optimizations lurking in the rest of
the code.  But a quick search didn't turn up any.