This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: guile-vm-0.0


Keisuke Nishida <kxn30@po.cwru.edu> writes:

> > However, the first point that struck me: does your VM perform
> > tail-call optimizations, as required by the RnRS?  I couldn't test it
> > myself, because the compiler failed for me like this:
> 
> Not yet, unfortunately.  I don't want to have the VM take care of such
> optimizations; instead, I need to improve the compiler.  The compiler
> is far from completed.  I'll tackle this from now..

Okay, I added the optimization.  I added a new instruction %tail-call,
which efficiently handles tail calls.

A simple benchmark from the QScheme's web site:

  % cat loop.scm
  (define (loop i l) (if (< i l) (loop (+ 1 i) l) l))
  (loop 0 3000000)


  % guile-vm
  guile> (vm-run (make-vm) (compile '(define (loop i l) (if (< i l) (loop (+ 1 i) l) l))))
  guile> (time (vm-run (make-vm) (compile '(loop 0 3000000))))
  clock utime stime cutime cstime gc
  0.69  0.69  0     0      0      0
  3000000


  % time qscheme < loop.scm
  ; QScheme 0.5.1 - A fast implementation of the Scheme language
  ; Copyright (C) 1998-2000 Daniel Crettol <dan@sof.ch>
  ; QScheme is distributed under the GNU General Public Licence.
  ; See the COPYING and LICENCE_EXCEPTION files for more informations.
  ;
  ; Native threads enabled...
  ;
  ; macro.scm ok
  ; sgtk/defextern.scm ok
  ; s.scm ok
  QScheme> #<closure global #<proc (i l)  code=0x80830a0>>
  QScheme> 3000000
  QScheme> 
  0.92user 0.00system 0:00.95elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (195major+162minor)pagefaults 0swaps


  % time guile -s loop.scm
  8.21user 0.04system 0:08.25elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (198major+146minor)pagefaults 0swaps


Still it's faster than QScheme :)  So speed is okay.  I'm going to add
more features, including exception handling, continuation, debugging
support, macro expansion, etc.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]