Re: arrays vs linked lists

From: George (
Date: 01/06/99

On Tue, 5 Jan 1999, Invincibill wrote:

>circlemud utilizes arrays(or tables if you prefer) to store its world
>files. i realize the tables are magrinally smaller and at times quicker,

Save 4 bytes per item minus the original 4 byte array pointer overhead.
Much faster random because you pointer arithmetic one pointer instead of
walking all over memory loading random pieces in search of the one you

>but dont you all think that linked lists are better? you would also have
>less problems with segmentation faults and its much easier to avoid

More pointers to corrupt with linked lists, probably more problems. :)

>memory leaks with linked lists(IMHO). also, you could add a little more
>abstraction to it and possibly cut down on the code a bit.

Could, probably will moreso than current.

>i'm wondering if anybody has undertaken converting the whole info_storage
>scheme into linked lists.

I think Ebon Mists MUD did, but it's been awhile since I read his message.
He said it cut down loading time and made it much easier to do OLC with.

>you can more easily utilize faster search routines(BST's etc; i realize
>you can implement a bst with an array but its really really nasty)

Arrays are generally easier to search because you have a known pattern of
placement in memory.  However, it depends on your application.

>i have not, for the life of me, been able to undersand why it was done
>this way in the first place.(and i'm sure its because of something i
>dont know, because i'm sure Jer is a helluva lot better coder than i)

Probably because Diku did it that way.  And if you've looked at Diku's
code, you'll wonder why they did it that way.  (allocate_room() is ugly)

So in short, history.

George Greer, | Genius may have its limitations, but   (mostly) | stupidity is not thus handicapped.    |                  -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST