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

Array allocation loses



I have an application which will need to allocate a large number (thousands)
of little chunks of FIXNUMs, like FIXNUM ARRAYs of upper bound appx 10.
I find that allocation of FIXNUMs is extremely slow.  I made a test loop
that simply pushed a lot of similar objects onto a stack (list) and
measured the time it took to do a thousand of them.  Scaled down to small
numbers so you can understand them, here are the results.
	Form evaluated to give value pushed	Time taken (octal)  net time
	NIL					 11			  0
	1					 11			  0
	(SETQ N (ADD1 N)) in FIXNUM range	 13			  2
	(SETQ N (ADD1 N)) in BIGNUM range	 15			  4
	(MAKNAM '(A S D F))			 15			  4
	(INTERN (MAKNAM '(A S D F)))		 20			  9
	(ARRAY NIL FIXNUM 2)			664			653
Thus it seems to take about a hundred times as long to allocate a new
two-word FIXNUM array as it does to allocate a new FIXNUM or BIGNUM.
Is there any efficient way to allocate small array-like bunches of
FIXNUMs in MacLISP?  Since ARRAYs lose so badly I'm thinking of
kludging something up with PNAMEs, or just using LISTs of FIXNUMs.
Any better ideas?