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


Marius Vollmer <mvo@zagadka.ping.de> writes:

> > Okay, I added the optimization.  I added a new instruction %tail-call,
> > which efficiently handles tail calls.
> 
> Great!  I am becoming convinced that a byte-code interpreter is easier
> to make fast than a tree-code interpreter.  After implementing builtin
> versions of "<" and "+" for two arguments, my evaluator is about 20%
> faster than Guile's regular non-debugging evaluator.  Going further
> would mean more aggressive compile-time analysis and moving the
> tree-codes away from being close to Scheme.

Yes.  I can easily add any optimization wherever more speed is needed.
Also, it seems the VM produces less garbages during execution, since
most execution is done on the stack.  This reduces the time spent in GC.

> I noticed a bug in your code for builtin relational operators:
>     #define REL2(CREL,SREL)						\
>           POP (v0);							\
>           if (SCM_INUMP (v0) && SCM_INUMP (ac))			\
>             RETURN (SCM_BOOL (SCM_INUM (v0) CREL SCM_INUMP (ac)));	\
> 
> This should be "SCM_INUM", no?  You probably fixed this already.

Right.  I fixed it.

> > Still it's faster than QScheme :)
> 
> But note, that you are timing QScheme's startup time as well here.
> Maybe it's insignificant.

It was not very significant.  This is the result increased by ten:

  guile> (time (vm-run (make-vm) (compile '(loop 0 30000000))))
  clock utime stime cutime cstime gc
  6.71  6.71  0     0      0      0
  30000000

  % 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> 30000000
  QScheme> 
  8.87user 0.07system 0:09.18elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (277major+162minor)pagefaults 0swaps


And this is the result with no computed goto (non-GCC support):

  guile> (time (vm-run (make-vm) (compile '(loop 0 30000000))))
  clock utime stime cutime cstime gc
  17.15 17.12 0.01  0      0      0
  30000000

It's about 2.5 times slower :(

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