Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8800) [RFC] Usage of speclist vs specvec
Home

[Freeciv-Dev] Re: (PR#8800) [RFC] Usage of speclist vs specvec

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8800) [RFC] Usage of speclist vs specvec
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 22 May 2004 02:15:32 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8800 >

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8800 >
> 
> Raimar Falke wrote:
> 
> 
>>I think this is a bit bold to say. If you for example change the size
>>a lot the list has less overhead (malloc + copy).
> 
> I doubt that very much.  Can you show numbers?

Well, nevermind - that would be a waste of time.

Both speclist and specvec are O(1) on insert and most other operations.

Specvec is O(1) on indexed lookups, whereas speclist is O(n).

Speclist can only handle pointers, specvec can handle any data type.

Speclist's interface is a little easier for unordered lists.

With specvec it is impossible to delete elements from the middle.  Or at 
best it's O(n) if you do it manually (compared to O(1) for speclist).

jason




[Prev in Thread] Current Thread [Next in Thread]