We already have to check the presence of the string/object in cache so avoiding AddObject() also eliminates the Find().
Regards, SZ On Wed, Dec 8, 2010 at 10:46 AM, Arno Garrels <arno.garr...@gmx.de> wrote: > Fastream Technologies wrote: > > Hello Arno, > > > > On Tue, Dec 7, 2010 at 7:48 PM, Arno Garrels <arno.garr...@gmx.de> > > wrote: > > > >> Fastream Technologies wrote: > >>> Hello, > >>> > >>> I have fixed the function as below (providing for the sake of > >>> completeness): > >> > >> You are re-inventing the wheel. Simply set property > >> TStringList.Sorted to True > >> and a Add() or AddObject() uses binary search to Insert data at the > >> right index. > >> > >> > > I thought you opposed to it when I did just that! Maybe I > > misunderstood (?). > > > > Also I think a string list index is better for search speed than tree > > structures. This is for the cache, you know. And we also have a STL > > std::list for deletes (to know which files are the oldest). > > Then you already have to Insert into two lists which makes it once > more slower. That is why the ICS TSslAvlSessionCache uses two linked > AVL trees, one has an index on the key and the second on a time stamp, > time stamp duplicates are handled in a list. > A sorted list is faster only when data isn't added frequently. > > > > > One OT question: Would it be faster if we use the cat() method of > > AnsiString instead of the + operand? > > I don't know, sorry. > > -- > 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 > -- 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