Array new: 1000000 performance question

lex at cc.gatech.edu lex at cc.gatech.edu
Sat Jul 24 00:51:36 UTC 2004


Colin Putney <cputney at wiresong.ca> wrote:
> I propose the following solution: don't use million-element Arrays.
> 

Here here!  Notice that *any* garbage collector can be defeated if you
try hard.

I'm not sure that (Array new: 1000000) is inherently silly, though, and
to make it worse, trracking down why this is slow does not teach people
anything that's very pleasant to learn.  Maybe we should have a large
array class in the image by default, and have:

	Array class>>new: count
		(count > 1000) ifTrue: [
			^LargeArray new: count ]
		ifFalse: [
			^super new: count ]


It would seem to make Squeak a little friendlier.


-Lex



More information about the Squeak-dev mailing list