[plt-scheme] xxx chooses MzScheme as preferred language

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 31 21:40:40 EDT 2006

At Wed, 31 May 2006 16:10:26 -0700 (PDT), Brent Fulgham wrote:
> On May 31, 2006, at 1:51 PM, Matthias Felleisen wrote:
> > Bigloo isn't Scheme per se. To achieve such numbers, you're programming  
> > in a special-purpose language, especially when it comes to floats. You  
> > write (fp+ ...) everywhere. In Bigloo you declare types at module  
> > boundaries.
> Perhaps a better example would be Chicken, which is as far as I know fully
> compliant with the R5RS (and implements many SRFI's):
> http://shootout.alioth.debian.org/sandbox/benchmark.php?test=all〈=chicken&lang
> 2=mzc
> It is quite a bit faster than Mzc (in the 2x to 10x range) in most cases, 

I decided to try n-body, since that seemed to have the biggest
difference (13x).

Test code:
 A = mzc code from web page
 B = mzc code, wrapped in `module'
 C = chicken code from web page
 D = chicken code, adapted to mzscheme with module (useful macros below)

 Mac OS X x86:

  mzscheme -j 301.16, A : 233.335u 0.546s 3:54.22 
  mzscheme 301.16, A    : 190.339u 0.629s 3:11.35
  mzc 301.16, A         : 210.086u 0.567s 3:31.2

  mzscheme -j 301.16, B : 190.551u 0.425s 3:11.22
  mzscheme 301.16, B    : 133.048u 0.486s 2:13.81
  mzc 301.16, B         : 124.468u 0.437s 2:05.18

  mzscheme -j 301.16, D : 108.393u 0.268s 1:48.80 
  mzscheme 301.16, D    :  47.473u 0.166s 0:47.71
  mzc 301.16, D         :  68.289u 0.230s 1:08.94

  chicken 2.3, C        :  12.672u 0.081s 0:12.77

It's a good bet that mzc performance hasn't changed since v301. So, I
get 17x on my machine for the original tests (substituting mzc v301.16
for v301), 5.6x for mzc v301.16 (= v301?) using Chicken's code, and 4x
using MzScheme v301.16 (not mzc) with Chicken's benchmark.

My main conclusion: if someone wants to improve the MzScheme results,
consider starting with the Chicken code (and dump mzc after v301).



(define-syntax define-constant
  (syntax-rules ()
    [(_ id v) (define id v)]))

(define-syntax define-record
  (syntax-rules ()
    [(_ id field ...)
       (define-struct id (field ...))
       (define-assignment-alias id field) ...)]))

(define-syntax (define-assignment-alias stx)
  (syntax-case stx ()
    [(_ id field)
     (with-syntax ([orig (datum->syntax-object
			   (format "set-~a-~a!" 
				   (syntax-e #'id)
				   (syntax-e #'field))))]
		   [new (datum->syntax-object
			   (format "~a-~a-set!" 
				   (syntax-e #'id)
				   (syntax-e #'field))))])
       #'(define new orig))]))

Posted on the users mailing list.