Board index » delphi » name-value pair lookup in TstringList
Pawel Slusarz
![]() Delphi Developer |
Wed, 06 Apr 2005 08:27:44 GMT
|
Pawel Slusarz
![]() Delphi Developer |
Wed, 06 Apr 2005 08:27:44 GMT
name-value pair lookup in TstringList
I just looked at the source code, and the lookup:
aStringList.Values['mykeystring'] is done as a linear search. Considering that TStringList is _the_ Delphi class, shouldn't the lookup function check whether the string list is sorted and then use a boolean search for better performance? Now that I know about this inefficiency, the "associative array" functionality of TStringList seems pretty useless. I know this is not recommended, but instead of rewriting a bunch of my Paul |
Torjei Kvine
![]() Delphi Developer |
Wed, 06 Apr 2005 13:40:45 GMT
Re:name-value pair lookup in TstringListQuote"Pawel Slusarz" <REMOVEwiedz...@yahoo.comME> wrote in message interface uses type implementation function TStringList.IndexOfName(const Name: string): Integer; end. If two units has the same class name, the linker takes the code in the -- |
J Fren
![]() Delphi Developer |
Wed, 06 Apr 2005 14:46:17 GMT
Re:name-value pair lookup in TstringListTwo points :- a) Fiddling with the Delphi libraries is very dangerous. b) It is quite possible to have more than one Name=Value pair in a If you really want to 'improve' the TStringList then you should write That may not be so easy as the 'culprit' is and this is not a virtual method I shudder at the thought of the problems that could be introduced. On Sat, 19 Oct 2002 00:27:44 GMT, "Pawel Slusarz" Quote<REMOVEwiedz...@yahoo.comME> wrote: |
J Fren
![]() Delphi Developer |
Wed, 06 Apr 2005 15:38:09 GMT
Re:name-value pair lookup in TstringListI am pretty sure that simply adding another (later) Unit will not have much effect on the OP's original 'problem' As far as I understand, he wants to 'redefine' the basic TStringList I dont't think he wants to just have a 'different' TStringList that is Anyway I get the following error :- [Error] Unit2.pas(10): Cannot override a static method Removing the Override makes it work fine, when one calls the However does NOT call this 'redefined thing' - since the code in Classes.pas What this has done is to create a 'special' thing that replaces the This means that there will be two types of object floating around the On Sat, 19 Oct 2002 05:40:45 GMT, "Torjei Kvinen" Quote<torjei@hahaha_bluezone.no> wrote: |
Torjei Kvine
![]() Delphi Developer |
Wed, 06 Apr 2005 16:02:39 GMT
Re:name-value pair lookup in TstringListQuote"J French" <Bounce_It_je...@iss.u-net.com_.bin> wrote in message -- |
J Fren
![]() Delphi Developer |
Wed, 06 Apr 2005 16:12:32 GMT
Re:name-value pair lookup in TstringListAh - in D4 it is not That makes a major difference, but will it help the OP with his that he wanted to *replace* the basic TStringList class Surely what you suggested would only 'out scope' the TStringList Class On Sat, 19 Oct 2002 08:02:39 GMT, "Torjei Kvinen" Quote<torjei@hahaha_bluezone.no> wrote: |
Dan
![]() Delphi Developer |
Sat, 09 Apr 2005 00:29:22 GMT
Re:name-value pair lookup in TstringListQuote"Torjei Kvinen" <torjei@hahaha_bluezone.no> wrote in message Quote> "J French" <Bounce_It_je...@iss.u-net.com_.bin> wrote in message Dan Quote> -- |
Torjei Kvine
![]() Delphi Developer |
Sat, 09 Apr 2005 04:09:17 GMT
Re:name-value pair lookup in TstringListQuote"Dan F" <Da...@removeme.Bigfoot.Com> wrote in message method in TStrings. -- |