This is the mail archive of the guile@sourceware.cygnus.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]

Guile performance (was: xlib binding)


Nicolas Neuss <Nicolas.Neuss@IWR.Uni-Heidelberg.De> writes:

> Elk's performance seemed to me better than Guile's.  The reason was
> probably a personal decision of Tom Lord, who knew Aubrey Jaffer and
> collaborated with him at the time of Guile's foundation.  (This is
> also from Laumann's email, maybe others know better.)

Elk's performance has always been lower than SCM's.  (Guile is based
upon SCM.)  But performance was not the only argument for basing Guile
on SCM.  Portability was another argument, e.g.

I made a simple experiment.  The procedure `prime' below computes the
Nth prime number.  The algorithm is inefficient but I think the code
has a pretty natural blend of common Scheme program operations.
The procedure `test' counts the number of times the 100th prime has
been calculated.

I tested how many times different Scheme interpreters on my machine
(Dell Inspiron 7000 with 333MHz Pentium II) could find the 100th prime
in one minute.  Notice the good performance of SCM.  It is interesting
to note that most improvements which have made SCM this fast can
reasonably easily be transferred to Guile since SCM and Guile have
very similar acrhitectures.

Interpreter		Turns/minute (high number good)
-----------		-------------------------------
SCM 5d0			678
Guile 1.3.4		442
RScheme 0.7.2		334
Elk 3.0			170

;;; Code:

;; Uncomment this for Guile
;; (debug-disable 'debug)

;; Uncomment this for Elk
;; (set! garbage-collect-notify? #f)

(define (prime n)
  (letrec ((prime? (lambda (n primes)
		     (or (null? primes)
			 (and (not (zero? (remainder n (car primes))))
			      (prime? n (cdr primes)))))))
    (let loop ((i 2) (candidate 2) (primes '()))
      (cond ((not (prime? candidate primes))
	     (loop i (+ 1 candidate) primes))
	    ((= i n) candidate)
	    (else
	     (loop (+ 1 i) (+ 1 candidate) (cons candidate primes)))))))

(define (test)
  (let loop ((count 1))
    (prime 100)
    (display count)
    (newline)
    (loop (+ 1 count))))

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