[Openmcl-devel] I knew format was slow, but this slow ??

Sven Van Caekenberghe sven at beta9.be
Thu Oct 2 14:06:15 UTC 2003


I knew format was slow, but can it be really this slow ??

Note that the difference between 10 and 100 iterations in the first 
loop results not in a 10-fold difference in time, but a 100-fold 
difference - so its gets exponentially slower !

The write-string version is almost a 1000 times faster, is this still 
normal ? Also note the extreme differences in memory allocation.

? (time (with-open-file (out #p"home:Desktop;test.txt" :direction 
:output :if-exists :overwrite)
     (dotimes (i 10)
       (dotimes (j 128)
	(format out "01234567")))))
(WITH-OPEN-FILE (OUT #4P"home:Desktop;test.txt" :DIRECTION :OUTPUT 
:IF-EXISTS
                  :OVERWRITE)
   (DOTIMES (I 10)
     (DOTIMES (J 128)
       (FORMAT OUT "01234567")))) took 740 milliseconds (0.740 seconds) 
to run.
Of that, 710 milliseconds (0.710 seconds) were spent in user mode
          0 milliseconds (0.000 seconds) were spent in system mode
          30 milliseconds (0.030 seconds) were spent executing other OS 
processes.
  62,224 bytes of memory allocated.
NIL
? (time (with-open-file (out #p"home:Desktop;test.txt" :direction 
:output :if-exists :overwrite)
     (dotimes (i 100)
       (dotimes (j 128)
	(format out "01234567")))))
(WITH-OPEN-FILE (OUT #4P"home:Desktop;test.txt" :DIRECTION :OUTPUT 
:IF-EXISTS
                  :OVERWRITE)
   (DOTIMES (I 100)
     (DOTIMES (J 128)
       (FORMAT OUT
               "01234567")))) took 80,138 milliseconds (80.138 seconds) 
to run.
Of that, 67,330 milliseconds (67.330 seconds) were spent in user mode
          0 milliseconds (0.000 seconds) were spent in system mode
          12,808 milliseconds (12.808 seconds) were spent executing 
other OS processes.
3,345 milliseconds (3.345 seconds) was spent in GC.
  93,340,544 bytes of memory allocated.
NIL
? (time (with-open-file (out #p"home:Desktop;test.txt" :direction 
:output :if-exists :overwrite)
     (dotimes (i 100)
       (dotimes (j 128)
	(write-string "01234567" out)))))
(WITH-OPEN-FILE (OUT #4P"home:Desktop;test.txt" :DIRECTION :OUTPUT 
:IF-EXISTS
                  :OVERWRITE)
   (DOTIMES (I 100)
     (DOTIMES (J 128)
       (WRITE-STRING "01234567"
                     OUT)))) took 90 milliseconds (0.090 seconds) to run.
Of that, 90 milliseconds (0.090 seconds) were spent in user mode
          0 milliseconds (0.000 seconds) were spent in system mode
  776 bytes of memory allocated.

Sven


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list