From: pjb@... (Pascal J. Bourguignon) Date: 2009-08-24T20:50:12+09:00 Subject: Re: Comparison Ruby, Python, Php, Groovy ecc. Urabe Shyouhei writes: > Are those executables compiled with identical compilers + compile flags? The question is understandable, but these implementation might very well be written in different languages, so it doesn't really matter. We can assume that they are as much as possible, if they come from a common distribution. > Marco Mastrodonato wrote: >> Comparison script languages for the fractal geometry, these are the >> languages i tested: >> >> Java >> Lua 5.1.4 >> Php 5.3.0 >> Python 2.6.2 >> Python 3.1.1 >> Jython 2.5.0 >> Groovy 1.6.3 >> Jruby 1.3.1 >> Ruby 1.9.1 p129 >> Ruby 1.8.6 p368 >> Ruby 1.8.6 p111 >> IronRuby 0.9.0 >> IronPython 2.0.2 >> Perl 5.10.0 >> >> Let me know yours comment >> >> http://mastrodonato.info/index.php/2009/08/comparison-script-languages-for-the-fractal-geometry/?lang=en I added a comment to the web site, but I'm not sure it was taken into account (I didn't got the same feed back as for a second shorter comment). So here it is again: For completeness, could you please try Common Lisp too? You could use sbcl 1.0.29 (MS-Windows port in progress) at: http://prdownloads.sourceforge.net/sbcl/sbcl-1.0.29-x86-windows-binary.msi -------(bench1.lisp)---------------------------------------------------- (declaim (optimize (speed 3) (space 2) (debug 0) (safety 0))) (declaim (ftype (function (single-float single-float) fixnum) iterate)) (defparameter *bailout* 16.0) (defparameter *max-iterations* 1000) (defun bench1 () (format t "Rendering...~%") (force-output) (loop :for y fixnum :from -39 to 39 :do (terpri) (loop :for x fixnum :from -39 to 39 :do (princ (if (zerop (iterate (the single-float (/ x 40.0)) (the single-float (/ y 40.0)))) "*" " ")))) (finish-output)) (defun iterate (x y) (declare (single-float x y)) (loop :with cr single-float = (- y 0.5) :with ci single-float = x :with zi single-float = 0.0 :with zr single-float = 0.0 :for i fixnum :from 0 :below *max-iterations* :do (let ((temp (* zr zi)) (zr2 (* zr zr)) (zi2 (* zi zi))) (declare (single-float temp zr2 zi2)) (setf zr (+ (- zr2 zi2) cr) zi (+ temp temp ci)) (when (< (the single-float *bailout*) (the single-float (+ zi2 zr2))) (return-from iterate i))) :finally (return-from iterate 0))) (time (bench1)) ------------------------------------------------------------------------ Run the test with: sbcl --no-userinit --eval '(load (compile-file "bench1.lisp"))' --eval '(quit)' -- __Pascal Bourguignon__