Re: [twsocket] IndexOf is slow when there are thousands of clientsconnected

2010-12-07 Thread Fastream Technologies
So you are right in your saying that when Sorted = true, Add()'s are with binary search. But there is a HACK one needs to be very careful about: If you do not set Duplicates = dupAccept, then it calls IndexOf() before inserting to see if the same value exists!! That must have been the reason our c

Re: [twsocket] IndexOf is slow when there are thousands of clientsconnected

2010-12-07 Thread Arno Garrels
Anton S. wrote: > Arno wrote: >> I don't think so, why should it? > > Well, the connection to HTTP client is closed when response is sent That depends on whether the client uses HTTP 1.0 or HTTP 1.1 and whether or not the Keep-Alive header is sent. > (usually; there are some options in the requ

Re: [twsocket] IndexOf is slow when there are thousands of clientsconnected

2010-12-07 Thread Fastream Technologies
Hello, I have fixed the function as below (providing for the sake of completeness): function seekIndexToInsertForSortedStringList(stringList: TStringList; stringToAdd: String; caseinsensitive: boolean) : Integer; var low, mid, high: integer; begin if(stringList.Count = 0) then begin

Re: [twsocket] IndexOf is slow when there are thousands of clientsconnected

2010-12-07 Thread Anton S.
Arno wrote: >I don't think so, why should it? Well, the connection to HTTP client is closed when response is sent (usually; there are some options in the request header to keep it but these cases are rarer). I'm just supposing, not asserting. -- Anton -- To unsubscribe or change your settings

Re: [twsocket] IndexOf is slow when there are thousands of clientsconnected

2010-12-07 Thread Arno Garrels
Anton S. wrote: > I dared to start the discussion in a separate thread. > >> 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 exhau

Re: [twsocket] IndexOf is slow when there are thousands of clientsconnected

2010-12-07 Thread Arno Garrels
Arno Garrels wrote: > Fastream Technologies wrote: >> As far as I know, the TStringList->AddObject() method uses binary >> search for finding the correct index to insert when >> TStringList->Sorted = true. I don't know why I thought so but there >> is the method, > > Yes, it actually uses function