in reply to Quicker Array Searching
The bulk of your speed problem is inherent to the notion of comparing the text of each message with the text of each other message. If you could redesign your algorithm to analyse each message once and create some sort of numeric index, sort the messages by their index, and then only compare the actual text of ones that are "close", you can speed it up to maybe O(n^2) or perhaps O(n log n) time. A modern system can probably handle that for a few thousand messages. O(n!) time, however, is right out of the question, as you will discover if you try to run it.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
|
|---|