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

File output performance



I am trying to improve the performance of a section of a program that creates a
simple ASCII text file.  It takes forever (about 45 minutes to create a 1 MEG.
file.).

Is there a way I could buffer the file output or do something else to improve
performance?

The following is a section of some code I wrote to create an ASCII file from a
CLOS data structure:

    ;--------------------------------------------------------------------------
    ;Print the data [rows] to the file.
    ;--------------------------------------------------------------------------
    (do ((ROW-NUMBER 1 (+ ROW-NUMBER 1)))
        ((> ROW-NUMBER ROWS)
         (close FILE-STREAM))
      
      (do ((COLUMN-NUMBER 1 (+ 1 COLUMN-NUMBER)))
          ((> COLUMN-NUMBER COLUMNS)
           (format FILE-STREAM "~%"))
        (format FILE-STREAM "~S" (nth COLUMN-NUMBER (assoc ROW-NUMBER 
                                                           (DATA
TABLE-SYMBOL))))
        (if (not (= COLUMN-NUMBER COLUMNS))
          (format FILE-STREAM ","))

Thanks.