Note that hashing will only work out as better if you need to find several elements. IIRC the tradeoff is around 7 elements or so, above that and building the hash works, less and you might as well grep.
And if you want to create the hash, the fastest way I know of is: