[plt-scheme] DrScheme Faster on Powerset than MzScheme - Why?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Mar 15 22:28:45 EDT 2007

I'm not sure why drscheme was faster than mzscheme (they should be
about the same, if you disable debugging in drscheme, modulo life in a
bigger heap, which seems to require more gc time, but I'm not sure),
but mz will be faster the 2nd and later times becuase of caching
effects at the OS level.

Robby

On 3/15/07, Jon Rafkind <workmin at ccs.neu.edu> wrote:
>
>
> Kyle Smith wrote:
> > I was actually benchmarking DrScheme against another flavor of Scheme,
> > and I thought the results were unfair, since DrScheme is also an IDE.
> > So I compiled to .zo (which didn't alter the times appreciably) and
> > ran this little powerset routine in DrScheme and MzScheme with the
> > following results.
> > -------------- THE CODE --------------
> > (module powerset mzscheme
> >   (provide go)
> > (define (power-set s)
> >   (if (null? s)
> >       (list '())
> >       (let ((rest (power-set (cdr s))))
> >         (append (map (lambda(x) (cons (car s) x)) rest) rest))))
> > (define (go)
> >   (collect-garbage)
> >   (time
> >    (let ([ps (power-set '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
> > 19 20))])
> >      'powerset)))
> >   )
> > -------------- THE RESULTS ------------
> > Welcome to DrScheme, version 369.8-svn2mar2007 [3m].
> > Language: Textual (MzScheme, includes R5RS).
> > > (require powerset)
> > > (go)
> > cpu time: 469 real time: 468 gc time: 265
> > powerset
> > > (go)
> > cpu time: 469 real time: 469 gc time: 266
> > powerset
> > -----------------------------------------------------------------------------------
> > C:\Documents and Settings\kyle\My Documents\Scheme\math>mzscheme -q
> > --require powerset.scm
> > Welcome to MzScheme v369.8 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
> > > (go)
> > cpu time: 563 real time: 563 gc time: 405
> > powerset
> > > (go)
> > cpu time: 563 real time: 563 gc time: 376
> > powerset
> > > (exit)
> > -----------------------------------------------------------------------------------
> > I was really surprised that DrScheme beat out MzScheme.   Do I have
> > something setup wrong on the command line of MzScheme, as I don't
> > often use the stand-alone interpreter, so I could be missing something?
> Drscheme gave me anything in the range of 530-830, I'm not sure why
> there would be such a variation.
> drscheme:
> cpu time: 588 real time: 586 gc time: 340
> powerset
>  >
> But mzscheme seemed to do much better the 2nd or 3rd time I ran (go):
>
> $ mzscheme -f x.ss
> Welcome to MzScheme version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
> cpu time: 824 real time: 829 gc time: 596
>  > (go)
> cpu time: 284 real time: 285 gc time: 100
> powerset
>  > (go)
> cpu time: 296 real time: 298 gc time: 116
> powerset
>  > (go)
> cpu time: 292 real time: 295 gc time: 116
> powerset
>  > (go)
> cpu time: 292 real time: 291 gc time: 116
> powerset
>
> I thought because of the JIT, naturally, but if I turn the JIT off I get
> the same results.
> $ mzscheme -f x.ss -j
> Welcome to MzScheme version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
> cpu time: 896 real time: 901 gc time: 592
>  > (go)
> cpu time: 360 real time: 358 gc time: 104
> powerset
>  > (go)
> cpu time: 376 real time: 376 gc time: 112
> powerset
>  > (go)
> cpu time: 348 real time: 369 gc time: 108
> powerset
>  >
> Although slightly slower than the JIT'ed one its still much faster than
> drscheme.
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.