[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] Re: tespol benchmark
From: |
Camm Maguire |
Subject: |
[Gcl-devel] Re: tespol benchmark |
Date: |
23 Jun 2006 14:20:24 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings, and thanks for the kind words.
Here is what I'm really striving for:
(defun eval-pol1 (n x)
(declare (single-float x))
(let ((su 0.0) (mu 10.0) (pu 0.0)
(pol (make-array 100 :element-type 'single-float)))
(dotimes (i n)
(setf su 0.0)
(dotimes (j 100)
(setf mu (/ (+ mu 2.0) 2.0))
(setf (aref pol j) mu))
(dotimes (j 100)
(setf su (+ (aref pol j) (* su x))))
(setf pu (+ pu su))
)
(prin1 pu)))
(defun eval-pol (n x)
(declare (fixnum n) (single-float x))
(let ((su 0.0) (mu 10.0) (pu 0.0)
(pol (make-array 100 :element-type 'single-float)))
(declare (single-float su) (single-float mu) (single-float pu))
(dotimes (i n)
(declare (fixnum i))
(setf su 0.0)
(dotimes (j 100)
(declare (fixnum j))
(setf mu (the single-float (/ (+ mu 2.0) 2.0)))
(setf (aref pol j)
(the single-float mu)))
(dotimes (j 100)
(declare (fixnum j))
(setf su (the single-float
(+ (aref pol j) (the single-float (* su
x))))))
(setf pu (the single-float (+ pu su)))
)
(prin1 pu)
))
(compile 'eval-pol)
(compile 'eval-pol1
(time (eval-pol1 500000 0.2))
1250000.0
real time : 1.890 secs
run-gbc time : 1.890 secs
child run time : 0.000 secs
gbc time : 0.000 secs
1250000.0
>(time (eval-pol 500000 0.2))
1250000.0
real time : 1.890 secs
run-gbc time : 1.890 secs
child run time : 0.000 secs
gbc time : 0.000 secs
1250000.0
Take care,
Robert Boyer <address@hidden> writes:
> Interesting benchmark below, after
>
> http://dan.corlan.net/bench.html
>
> Conclusion: Here, GCL 2.7.0 is 6 times faster than Allegro
> and is 1.5 times faster than cmu|sbcl but still only half as
> fast as Fortran.
>
> For new projects in which one is free to choose the
> language, one should choose Lisp. -- Corlan
>
> What's most amazing, even incredible to me, is that I did
> not put in a single Lisp declaration myself, except for the
> optimize, so that all Lisps were shooting at the same
> target. Your work on the GCL compiler is awesome.
>
> Bob
>
> P. S. Benchmarking is such a black art that this message
> should not have been written. But I just can't stop. Lord
> only knows what all I did wrong this time.
>
> -------------------------------------------------------------------------------
>
> Transcript just now on antones.cs.utexas.edu, Ubuntu,
> (Pentium 4 3.00GHz).
>
> % cat tespol.f
> program tespol
> dimension pol(100)
> real pol
> integer i,j,n
> real su,pu,mu
> real x
>
> n = 500000
> x = 0.2
> mu = 10.0
> pu = 0.0
> do i = 1,n
> do j=1,100
> mu = (mu + 2.0) / 2.0
> pol(j) = mu
> enddo
> su = 0.0
> do j=1,100
> su = x * su + pol(j)
> enddo
> pu = pu + su
> enddo
> write (*,*) pu
> end
> % g77 tespol.f -O6 -o tespol
> time ./tespol
> % 1250000.
> 0.476u 0.000s 0:00.47 100.0% 0+0k 0+0io 0pf+0w
>
> % cat tespol.l
> (declaim (optimize (safety 0) (speed 3)))
>
> (defun eval-pol (n x)
> (declare (fixnum n) (single-float x))
> (let ((su 0.0) (mu 10.0) (pu 0.0)
> (pol (make-array 100 :element-type 'single-float)))
> (declare (single-float su) (single-float mu) (single-float pu))
> (dotimes (i n)
> (declare (fixnum i))
> (setf su 0.0)
> (dotimes (j 100)
> (declare (fixnum j))
> (setf mu (the single-float (/ (+ mu 2.0) 2.0)))
> (setf (aref pol j)
> (the single-float mu)))
> (dotimes (j 100)
> (declare (fixnum j))
> (setf su (the single-float
> (+ (aref pol j) (the single-float (* su
> x))))))
> (setf pu (the single-float (+ pu su)))
> )
> (prin1 pu)
> ))
>
> (compile 'eval-pol)
>
> (time (eval-pol 500000 0.2))
> % xg
> GCL (GNU Common Lisp) 2.7.0 ANSI Jun 23 2006 08:10:39
> Source License: LGPL(gcl,gmp,pargcl), GPL(unexec,bfd)
> Binary License: GPL due to GPL'ed components: (BFD UNEXEC)
> Modifications of this banner must retain notice of a compatible license
> Dedicated to the memory of W. Schelter
>
> Use (help) to get some basic information on how to use GCL.
>
> Temporary directory for compiler files set to /tmp/
>
> >(load "tespol.l")
>
> Loading tespol.l
> ;; Compiling /tmp/gazonk_30441_0.lsp.
> ;; End of Pass 1.
> ;; End of Pass 2.
> ;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3,
> (Debug quality ignored)
> ;; Finished compiling /tmp/gazonk_30441_0.o.
> Loading /tmp/gazonk_30441_0.o
> start address -T 0xac23a00 Finished loading /tmp/gazonk_30441_0.o
> 1250000.0
> real time : 1.080 secs
> run-gbc time : 1.080 secs
> child run time : 0.000 secs
> gbc time : 0.000 secs
> Finished loading tespol.l
> T
>
> >% acl
> International Allegro CL Enterprise Edition
> 7.0 [Linux (x86)] (Jun 29, 2005 9:23)
> Copyright (C) 1985-2004, Franz Inc., Oakland, CA, USA. All Rights Reserved.
>
> This development copy of Allegro CL is licensed to:
> [TC8015] University of Texas
>
> ;; Optimization settings: safety 1, space 1, speed 1, debug 2.
> ;; For a complete description of all compiler switches given the
> ;; current optimization settings evaluate (EXPLAIN-COMPILER-SETTINGS).
> CL-USER(1): (load "tespol.l")
> ; Loading /v/filer2/boyer/tespol.l
> 1250000.0
> ; cpu time (non-gc) 6,810 msec user, 10 msec system
> ; cpu time (gc) 0 msec user, 0 msec system
> ; cpu time (total) 6,810 msec user, 10 msec system
> ; real time 6,814 msec
> ; space allocation:
> ; 12 cons cells, 512 other bytes, 0 static bytes
> T
> CL-USER(2): EOF
> Really exit lisp [n]? y
> ; Exiting
> 6.832u 0.012s 0:15.88 43.0% 0+0k 0+0io 0pf+0w
> % sbcl
> This is SBCL 0.9.8, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
>
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses. See the CREDITS and COPYING files in the
> distribution for more information.
> * (load "tespol.l")
> ; in: LAMBDA NIL
> ; (PRIN1 PU)
> ;
> ; note: doing float to pointer coercion (cost 13) from PU
> ;
> ; compilation unit finished
> ; printed 1 note
> 1250000.0
> Evaluation took:
> 1.658 seconds of real time
> 1.656104 seconds of user run time
> 0.0 seconds of system run time
> 0 page faults and
> 0 bytes consed.
> T
> * % cmucl
> CMU Common Lisp 19b (19B), running on antones.cs.utexas.edu
> With core: /v/filer3/v0q027/cmucl/lib/cmucl/lib/lisp.core
> Dumped on: Mon, 2005-06-27 19:09:58-05:00 on lorien
> See <http://www.cons.org/cmucl/> for support information.
> Loaded subsystems:
> Python 1.1, target Intel x86
> CLOS based on Gerd's PCL 2004/04/14 03:32:47
> * (load "tespol.l")
>
> ; Loading #P"/v/filer2/boyer/tespol.l".
> ; Compiling LAMBDA (N X):
>
> ; In: LAMBDA (N X)
>
> ; (PRIN1 PU)
> ; Note: Doing float to pointer coercion (cost 13) from PU.
> ;
> ; Compiling Top-Level Form:
>
> ; Compilation unit finished.
> ; 1 note
>
> ; Compiling LAMBDA NIL:
> ; Compiling Top-Level Form:
> 1250000.0
> ; Evaluation took:
> ; 1.58 seconds of real time
> ; 1.556097 seconds of user run time
> ; 0.0 seconds of system run time
> ; 4,740,004,193 CPU cycles
> ; 0 page faults and
> ; 1,184 bytes consed.
> ;
> T
> * (quit)
> %
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gcl-devel] Re: tespol benchmark,
Camm Maguire <=