If you are building this array and if the elements will definately be unique, then put it in a hash! A hash does lookups much faster than any array search method. That is, as long as you don't care about maintaining the order of the input items.
Next best thing would be if the array was sorted somehow, you can implement a Binary Search to search the array. This would be tons faster than your current method which is an Iterative search.
In reply to Re: Very slow array searching
by pzbagel
in thread Very slow array searching
by Rafaqat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |