Try a fast sorted matching algorithm first.

This is much, much faster than the full matching
algorithm, and in common cases (e.g. arrays of numbers
or strings) works just fine.  See the benchmarks
for how much of a difference this makes!