This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: guile-vm-0.1
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> I've had a quick look at your vm now and am very impressed
>
> I like your code. It's really good quality.
> I'm very happy that you are working on this.
Thanks. You'll find some better code in the next release :)
> I tested it with a small benchmark function which is slightly more
> similar to a real program than the usual empty loop:
>
> (define (foo n p)
> (cond ((zero? n) p)
> ((null? p) (foo (- n 1) (cons p p)))
> (else (foo (- n 1) (car p)))))
>
> Your vm evaluates (foo 10000000 '()) in 31 s.
The problems with this are:
1. My VM hasn't implemented internal `zero?' or `null?'.
2. My compiler doesn't optimize (- n 1) to (1- n).
With these small fixes, you'll see my VM evaluates it as fast as QScheme.
(But not faster; I guess that is mainly because 28% of the time was spent
in GC.)
% cat foo.scm
(define (foo n p)
(cond ((zero? n) p)
((null? p) (foo (1- n) (cons p p)))
(else (foo (1- n) (car p)))))
(foo 10000000 '())
% guile-vm
guile> (compile-file "foo.scm")
guile> (time (load "foo.scc"))
clock utime stime cutime cstime gc
6.91 6.89 0.02 0 0 1.98
% time qscheme < foo.scm
(snip)
6.22user 0.07system 0:06.28elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (180major+153minor)pagefaults 0swaps
And thanks for your patch :)