Board index » delphi » Linked lists in Delphi?

Linked lists in Delphi?

I have a minor problem concerning linked lists in Delphi. I've been using the "manual"
way to handle lists, but now, I heard that there are an object for such an operation -
the TList object.

My question is - Which way is best(I mean fastest). The TList or the manual way?

Thanks,
- Cristian

 

Re:Linked lists in Delphi?


In article <1995Nov21.140249.18...@gdunix.gd.chalmers.se>,
   Christian.Almstr...@Elektro.Ing.HB.SE (Cristian Almstrand) wrote:

Quote
>I have a minor problem concerning linked lists in Delphi. I've been using the
"manual"
>way to handle lists, but now, I heard that there are an object for such an
operation -
>the TList object.

>My question is - Which way is best(I mean fastest). The TList or the manual
way?

>Thanks,
>- Cristian

I prefer TList.  I don't have any overhead of maintaining it and its (IMHO)
bug-free.

I don't know about the speed though.

__________________________________________________________________________
"I blame my code first, second the compiler, then looking for a hammer..."

Re:Linked lists in Delphi?


In <1995Nov21.140249.18...@gdunix.gd.chalmers.se>, Christian.Almstr...@Elektro.Ing.HB.SE (Cristian Almstrand) writes:

Quote
>I have a minor problem concerning linked lists in Delphi. I've been using the "manual"
>way to handle lists, but now, I heard that there are an object for such an operation -
>the TList object.

>My question is - Which way is best(I mean fastest). The TList or the manual way?

>Thanks,
>- Cristian

Since the Deplhi provided components themselves use the list classes such as
TList and TStrings,  it would appear they are sufficiently efficient for most
purposes.  I would use them first and if they were found to be too slow for
some reason then worry about replacing them.

Dennis Meade

Re:Linked lists in Delphi?


Quote
Cristian Almstrand (Christian.Almstr...@Elektro.Ing.HB.SE) wrote:

: I have a minor problem concerning linked lists in Delphi. I've been using the "manual"
: way to handle lists, but now, I heard that there are an object for such an operation -
: the TList object.

: My question is - Which way is best(I mean fastest). The TList or the manual way?

: Thanks,
: - Cristian

Without having tried it, You might consider that TList is written in
assembler and ought to run faster than code written in pascal and then
compiled into assembler...

/Patrik
--

                                       _
-----________________--_   ________.--'-`--._____
 \____==================_)  \_'===================`
        _,--___.-|__|-.______|=====/  `---'
        ---------._          ~~~~~|             _
                    `-._ -  -  - ,'     Patrik Hagglund
     To boldly go       \_____,-'     d90-...@ludd.luth.se
 where no man has gone
        before                                    

Re:Linked lists in Delphi?


On Tue, 21 Nov 1995 13:58:56 GMT,

Quote
Christian.Almstr...@Elektro.Ing.HB.SE (Cristian Almstrand) wrote:
>I have a minor problem concerning linked lists in Delphi. I've been using the "manual"
>way to handle lists, but now, I heard that there are an object for such an operation -
>the TList object.

>My question is - Which way is best(I mean fastest). The TList or the manual way?

TList implements a dynamically resizeable array, not a linked list. If
you just need the semantics of a list, then TList works fine, but if
you need a linked list implementation, then you need to do it
yourself. (You only need to do it once, as a reusable class, of
course.)
--
Ray Lischner         (li...@tempest-sw.com)
Tempest Software, Corvallis, Oregon, USA

Other Threads