[Ecls-list] Slow prettyprinting

Waldek Hebisch hebisch at math.uni.wroc.pl
Mon Jan 14 20:12:38 UTC 2008


Juanjo wrote:
> On Jan 5, 2008 5:10 PM, Waldek Hebisch <hebisch at math.uni.wroc.pl> wrote:
> > Conversion of one selected file without
> > prettyprinting (more precisely, with printing using *print-pretty
> > set to nil) takes 0.221s and conses 14715352 bytes, with prettyprintig
> > conversion takes 10.372s and conses 618534296 bytes.  Lisp compilation
> > of resulting file take 4.110s.  So at this stage of build
> > prettyprintig is the bottleneck.
> 
> Understood. Well, the problem is that ECL is using SBCL's code to
> pretty-print. While this code might be optimally compiled in SBCL, I
> am unsure about the quality of the code generated by ECL for this
> particular file. I guess this has a lot to do with the fact that this
> code is based on CLOS and Gray streams and that method calls in ECL
> are not very efficient.
> 

I checked impact of method caching on prettyprinting.  On a sample
file I get:

ecl 0.9j
real time : 4.897 secs
run time  : 4.890 secs
gc count  : 159 times
consed    : 301105544 bytes

ecl CVS 2008-01-12 15:13
real time : 4.768 secs
run time  : 4.760 secs
gc count  : 136 times
consed    : 301098120 bytes

So, change to caching has measurable positive effect on prettyprinting.
But the effect is rather small.  Given amount of consing I suspect
that the bottlenect is somewhere else.  Also, sbcl conses about
100 time less then ecl.
 
For comparison:
sbcl:
  0.076 seconds of real time
  0.08 seconds of user run time
  0.0 seconds of system run time
  0 calls to %EVAL
  0 page faults and
  3,818,176 bytes consed.

clisp:
Real time: 0.087328 sec.
Run time: 0.09 sec.
Space: 8538440 Bytes
GC: 9, GC time: 0.05 sec

I used the following program to get times (the file "marko.clisp"
has 110 kb and contains a single S-expression):

(defvar form)
(progn (setf form (with-open-file (fil "marko.clisp") (read fil))) nil)
(let ((*print-readably t))
    (with-open-file (fil "out" :direction :output
                               :if-does-not-exist :create
                               :if-exists :overwrite)
       (time (pprint form fil)))
    nil)
(quit)

-- 
                              Waldek Hebisch
hebisch at math.uni.wroc.pl




More information about the ecl-devel mailing list