I'm developing web XMPP chat. After retrieving of Roster I'm putting people infos to array of objects, but before pushing object to array I must check for it previous existence on that array, and it's quite slow, because it makes operations in count of sum of arithmetic series, which is ex. 820 for 40 number of contacts, and that number doesn't make me happy. And my question is: are there any optimizations possible for search method in this case?
- Also I don't wan't to convert array to associative array.
- Objects are not sorted.
I know there are other threads, but there is nothing about optimization.