Fastream Technologies wrote: > Hello, > > I have seen a bottleneck in ICS with tens of thousands of clients: > When a client is disconnected the TWSocketServer calls > FClientList->IndexOf() for finding the index to remove the object! > IndexOf is simply exhaustive search and it is a huge CPU hog when > there are 30k clients! > > In some other parts of our code we wrote we overcome this issue by > using a sorted TStringList holding the pointers normally held in > FClientList->Items[] in stringList->Objects[] and converting the > memory address to first integer and then String and assigning it to > the stringList->Strings[] (with the same index of course). > > Then we use a binary search function to search among the Strings[] to > find the index and delete without IndexOf. It works perfectly!
Beside the fact that this has nothing to do with the subject "asynchronous sockets on Linux" your design is likely slower than current implementation. Though your binary search will be faster, inserts into a sorted list take much longer, you have to sum both, have you? -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be