One benefit to using a linked list is that no heap allocations would be necessary.
If you make it a doubly linked list and the method that removes a node from the linked list has a pointer directly to its own node, then no linear search is necessary. I may be way off on this, I'm not at all familiar with the requirements for loading DLs. -Steve ----- Original Message ---- > From: Andrei Alexandrescu <[email protected]> > To: Discuss the phobos library for D <[email protected]> > Sent: Wed, November 10, 2010 3:44:47 PM > Subject: Re: [phobos] Showstopper bug: Hello world fails on OSX! > > On 11/10/10 12:21 PM, Jacob Carlborg wrote: > > > > On 10 nov 2010, at 18:55, Sean Kelly wrote: > > > >> On Nov 10, 2010, at 4:23 AM, Michel Fortin wrote: > >> > >>> Le 2010-11-10 à 4:55, Jacob Carlborg a écrit : > >>> > >>>> I've been thinking about this and I'm trying to think of everything to >get this right the first time so I have a couple of questions: > >>>> > >>>> * I though it might be a good idea to add support for running module >constructors for dynamically loaded libraries (i.e. libraries loaded with >dlopen). Then I was think I need to add the new module infos to the array of >existing ones and when/if the library is unloaded remove the module infos >added >by the library. Now for the question: is an array still a good data structure >for this or should we use an associative array or something else? > >>> > >>> The Objective-C runtime uses a linked list. I think the expectation is >that you won't have thousands of libraries open and that you won't unload >them >often. But going with an AA doesn't look like a bad idea to me. > >> > >> The compiler runtime (src/rt/memory.d) uses a linked list for static data >segments... or it used to. I think it now may simply call gc.addRange. >Either >way, I think a linked list is a good approach. > > > > Ok, I guess a we'll use a linked list. > > I suggest we go with a hash. It costs next to nothing and has no future > scalability money. I bet money at least a few companies (Facebook > included) would run into severe scalability issues if linear search is > to be used. > > Andrei > _______________________________________________ > phobos mailing list > [email protected] > http://lists.puremagic.com/mailman/listinfo/phobos > _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
