[Openmcl-devel] multiply and memory allocation optimization question

Cyrus Harmon ch-openmcl at bobobeach.com
Sat Apr 24 21:10:07 PDT 2004

Dear Openmcl-dev,

I'm trying to figure out why following uses so much memory:

? (let ((acc 0)) (time (dotimes (i 10000) (incf acc (* i i)))) acc)
(DOTIMES (I 10000) (INCF ACC (* I I))) took 15 milliseconds (0.015 
seconds) to run.
Of that, 0 milliseconds (0.000 seconds) were spent in user mode
          0 milliseconds (0.000 seconds) were spent in system mode
          15 milliseconds (0.015 seconds) were spent executing other OS 
  141,240 bytes of memory allocated.

Short of using something like fp-ppc, is there a way to write this that 
won't result in so much memory being allocated? Can I force the 
evaluation of the * to be accumulated on a stack variable somehow?



More information about the Openmcl-devel mailing list