[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Re: [gambit-list] Help With Memory
From: |
Marc Feeley |
Subject: |
[Chicken-users] Re: [gambit-list] Help With Memory |
Date: |
Fri, 26 Sep 2008 12:21:36 -0400 |
On 26-Sep-08, at 11:45 AM, Alex Shinn wrote:
[I trimmed off the chicken-users list because I'm not
interested in a pissing match between implementations :)]
Marc Feeley <address@hidden> writes:
You are comparing Chicken to Chicken using different modes
right?
Nope, Chicken to Gambit.
When Chicken and Gambit are benchmarked in "r6rs-fixflo-unsafe" mode
(which combines declarations for standard-bindings, fixnum specific
operations and unsafe execution (no type checks)) the results I get
are:
ctak: Chicken is 1.03 times faster than Gambit
fibc: Gambit is 1.01 times faster than Chicken
I'm using Chicken 3.4.0 with the -Ob optimization level, and
Gambit 4.1.0 with
(declare (standard-bindings)
(extended-bindings)
(block)
(not safe)
(fixnum))
on an x86 Mac OS X machine. Running each benchmark 5 times
(as separate processes), discarding the high and low and
averaging the middle 3 times I get:
ctak fibc
Chicken 0.023 0.011
Gambit 0.033 0.024
hence the 1.4x and 2x claims.
--
Alex
When I try the same thing on my 2 GHz MacBook Pro (with ctak repeated
100 times and fibc repeated 1000 times) I get:
ctak fibc
Chicken 1.883s 4.551s
Gambit 1.970s 3.118s
So,
ctak: Chicken is 1.05 times faster than Gambit
fibc: Gambit is 1.46 times faster than Chicken
I've attached the trace and source code below. The wild difference in
performance you get is perhaps due to the old version of Gambit you
are using. Can you please try this on your machine with Gambit v4.2.8?
Marc
% gsc -v
v4.2.8
% gsc ctak.scm
% gsi ctak
(time (go 100))
1970 ms real time
1961 ms cpu time (1838 user, 123 system)
1434 collections accounting for 324 ms real time (292 user, 31
system)
1221381344 bytes allocated
no minor faults
no major faults
7
% gsc fibc.scm
% gsi fibc
(time (go 1000))
3118 ms real time
3103 ms cpu time (2945 user, 158 system)
1806 collections accounting for 411 ms real time (373 user, 38
system)
1538392000 bytes allocated
no minor faults
no major faults
2584
% csc -V
CHICKEN
(c)2008 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 3.3.0 - macosx-unix-gnu-x86 [ manyargs dload ptables applyhook ]
SVN rev. 11106 compiled 2008-09-22 on neo.local (Darwin)
Enter "chicken -help" for information on how to use it.
% csc -b ctak.scm
% ./ctak
1.883 seconds elapsed
0.044 seconds in (major) GC
0 mutations
71 minor GCs
91 major GCs
7
% csc -b fibc.scm
% ./fibc
4.551 seconds elapsed
0.093 seconds in (major) GC
0 mutations
206 minor GCs
174 major GCs
2584
% cat ctak.scm
(declare (standard-bindings)
(extended-bindings)
(block)
(not safe)
(fixnum))
(define (ctak x y z)
(call-with-current-continuation
(lambda (k) (ctak-aux k x y z))))
(define (ctak-aux k x y z)
(if (not (< y x))
(k z)
(call-with-current-continuation
(lambda (k)
(ctak-aux
k
(call-with-current-continuation
(lambda (k) (ctak-aux k (- x 1) y z)))
(call-with-current-continuation
(lambda (k) (ctak-aux k (- y 1) z x)))
(call-with-current-continuation
(lambda (k) (ctak-aux k (- z 1) x y))))))))
(define (go n)
(let loop ((n n) (r '()))
(if (> n 0)
(loop (- n 1) (ctak 18 12 6))
r)))
(pretty-print (time (go 100)))
% cat fibc.scm
(declare (standard-bindings)
(extended-bindings)
(block)
(not safe)
(fixnum))
(define (_1+ n) (+ n 1))
(define (_1- n) (- n 1))
(define (addc x y k)
(if (zero? y)
(k x)
(addc (_1+ x) (_1- y) k)))
(define (fibc x c)
(if (zero? x)
(c 0)
(if (zero? (_1- x))
(c 1)
(addc (call-with-current-continuation (lambda (c) (fibc (_1- x)
c)))
(call-with-current-continuation (lambda (c) (fibc (_1-
(_1- x)) c)))
c))))
(define (go n)
(let loop ((n n) (r '()))
(if (> n 0)
(loop (- n 1) (fibc 18 (lambda (n) n)))
r)))
(pretty-print (time (go 1000)))