From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA21670; Tue, 26 Nov 2002 10:43:23 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA21431 for ; Tue, 26 Nov 2002 10:43:22 +0100 (MET) Received: from jerry.kfunigraz.ac.at (GIGAJERRY.kfunigraz.ac.at [143.50.55.161]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gAQ9hL109327 for ; Tue, 26 Nov 2002 10:43:21 +0100 (MET) Received: from tom.kfunigraz.ac.at (mc_tom [10.10.1.160]) by jerry.kfunigraz.ac.at (8.11.2/8.11.2) with ESMTP id gAQ9hLm12594 for ; Tue, 26 Nov 2002 10:43:21 +0100 (MET) Received: from kfunigraz.ac.at (IGAM08AV.kfunigraz.ac.at [143.50.39.35]) by tom.kfunigraz.ac.at (8.11.2/8.11.2) with ESMTP id gAQ9hLJ30732; Tue, 26 Nov 2002 10:43:21 +0100 (MET) Message-ID: <3DE34238.9050804@kfunigraz.ac.at> Date: Tue, 26 Nov 2002 10:43:20 +0100 From: Siegfried Gonzi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: caml-list@inria.fr CC: Siegfried Gonzi Subject: Re: [Caml-list] Some clarifications to the language shootout page References: <3DE1E6CD.2020906@kfunigraz.ac.at> Content-Type: multipart/related; boundary="------------070304080909020508080807" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --------------070304080909020508080807 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit > Hi: The Bigloo boss Manuel tweaked the MM a little bit (2 little changes but with significant consequences): The Bigloo code can be reduced to 17s/17/s0.1s This is still a little bit higher than the OCaml version but it is damn close to within the factor of 2 to C. Compile it with: bigloo -v2 -Obench bench.scm -copt "-O3 -fomit-frame-pointer" Regards, S. Gonzi ==== Just one more thing, I have changed the Scheme code a very little bit to make it more similar to the Caml code. That is, I have changed the construction of the row vectors. The original initialization (mx (make-vector rows 0.0)) was breaking the CFA because mx what not correctly typed vector of vector of double. I have replaced it with: (mx (make-vector rows (make-vector 0 0.0))) Then, you should compile with: bigloo -v2 -Obench foo.scm -copt "-O3 -fomit-frame-pointer" On my machine with this two modifications I see an improvement of about 17%. It is still insufficient to defeat Ocaml but we are getting a little closer [:-)] -- Manuel -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|----- (module bench-matrix (option (set! *genericity* #f)) (main main)) (define (mkmatrix rows cols) (let ((mx (make-vector rows (make-vector 0 0.0))) (count 1.0)) (do ((i 0 (+fx i 1))) ((=fx i rows)) (let ((row (make-vector cols 0.0))) (do ((j 0 (+fx j 1))) ((=fx j cols)) (vector-set! row j count) (set! count (+fl count 1.0))) (vector-set! mx i row))) mx)) (define (num-cols mx) (let ((row (vector-ref mx 0))) (vector-length row))) (define (num-rows mx) (vector-length mx)) (define (mmult rows cols m1 m2) (let ((m3 (make-vector rows (make-vector 0 0.0)))) (do ((i 0 (+fx 1 i))) ((=fx i rows)) (let ((m1i (vector-ref m1 i)) (row (make-vector cols 0.0))) (do ((j 0 (+fx 1 j))) ((=fx j cols)) (let ((val 0.0)) (do ((k 0 (+fx 1 k))) ((=fx k cols)) (set! val (+fl val (*fl (vector-ref m1i k) (vector-ref (vector-ref m2 k) j))))) (vector-set! row j val))) (vector-set! m3 i row))) m3)) (define (do-main size) (let* ((m1 (mkmatrix size size)) (m2 (mkmatrix size size)) (mm (mmult size size m1 m2))) (let ((r0 (vector-ref mm 0)) (r2 (vector-ref mm 2)) (r3 (vector-ref mm 3)) (r4 (vector-ref mm 4))) (print (vector-ref r0 0) " " (vector-ref r2 3) " " (vector-ref r3 2) " " (vector-ref r4 4))))) (define (main x) (do-main 512)) -----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|----- ==== --------------070304080909020508080807-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners