[Openmcl-devel] consing iterating through a loop
ch-openmcl at bobobeach.com
Wed Jan 26 20:01:47 EST 2005
I'm trying to avoid allocating memory as I go through the loop. Here's
my code and problem:
(flet ((foo ()
(declare (optimize (speed 3) (safety 0) (space 0)))
(let ((z 2.0d0) (a 0d0))
(declare (double-float z)
(dotimes (i 500000)
(declare (fixnum i))
(setf (the double-float a)
(the double-float (+ (the double-float a) (the double-float
(FOO) took 760 milliseconds (0.760 seconds) to run.
Of that, 150 milliseconds (0.150 seconds) were spent in user mode
50 milliseconds (0.050 seconds) were spent in system mode
560 milliseconds (0.560 seconds) were spent executing other OS
361 milliseconds (0.361 seconds) was spent in GC.
8,000,000 bytes of memory allocated.
; in: LAMBDA NIL
; (THE DOUBLE-FLOAT A)
; note: doing float to pointer coercion (cost 13) from A
; compilation unit finished
; printed 1 note
0.002 seconds of real time
0.0 seconds of user run time
0.0 seconds of system run time
0 page faults and
96 bytes consed.
Any easy way to fix this?
More information about the Openmcl-devel