[squeak-dev] The Trunk: Collections-topa.726.mcz

Tobias Pape Das.Linux at gmx.de
Tue Dec 6 20:27:32 UTC 2016


On 06.12.2016, at 21:23, Levente Uzonyi <leves at caesar.elte.hu> wrote:

> On Tue, 6 Dec 2016, tim Rowledge wrote:
> 
>> 
>>> On 06-12-2016, at 11:08 AM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>>> Is there any use of these lists? I mean besides process scheduling.
>>> I can't imagine a use-case where I would use a LinkedList instead of an OrderedCollection (or another data structure).
>> 
>> Anywhere that needs frequent adding and removing of items mid-list, or growing/shrinking. Saves constantly making a new array, copying gazillions of OOPs and possibly #become.
> 
> Using the current implementation, addition might be O(1) if you hold a reference to the internal list node, but removal is O(n) unless you maintain backwards pointers - aka make the list doubly-linked.
> 
> OrderedCollection is far superior in growing/shrinking (provided it's done at one of its ends), both in term of run time and memory usage, since it needs fewer objects.

Yes.

But sometimes you need a linked list.
It is not that the trunk _should_ use it but that Squeak programmers _can_ use it.
Let's not impose too much on the programmers. Linked lists are pretty standard :)


Best regards
	-Tobias


More information about the Squeak-dev mailing list