swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setIndexFromMember followup (was Re: Lists


From: Marcus G. Daniels
Subject: Re: setIndexFromMember followup (was Re: Lists
Date: 19 Sep 1999 20:12:01 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "PJ" == Paul E Johnson <address@hidden> writes:

PJ> When it makes a difference: when using an index to find and remove
PJ> specific objects from a list.

If you have *the* object, then you aren't looking for it.  If the
object is an example of an object and you need to find the `real' one
for one reason or another, that's still a search and memberLoc doesn't
help you with that.

PJ> A command like [list remove: someParticularObject] is just as slow
PJ> with a regular list or one with the setIndexFromMemberLoc:. WHen
PJ> Doug observed that [remove: anObject] in the source for List was
PJ> still O(n), this is what he discovered.

In OrderedSet, remove: creates an index from the object member_t info,
and so the method remove: is fast.  The other cases are a linear search,
so if you have memberLoc, you need to do the remove via a created index.

PJ> Now, when is this a bad thing to do?

Almost always.  Basically, don't ever use it unless you need fast
removes.  The simple fact is it caused a non-obvious bug in Doug's
program and all this discussion should be evidence of why. 
It certainly won't be supported in the Java API.

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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