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 CAA07571; Sun, 9 May 2004 02:48:15 +0200 (MET DST) 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 CAA04974 for ; Sun, 9 May 2004 02:48:14 +0200 (MET DST) Received: from smtp.mbg.ocn.ne.jp (mbg.ocn.ne.jp [210.190.142.181]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i490mDEV017553 for ; Sun, 9 May 2004 02:48:13 +0200 Received: from localhost (p18223-adsau14honb7-acca.tokyo.ocn.ne.jp [220.106.131.223]) by smtp.mbg.ocn.ne.jp (Postfix) with ESMTP id 195F5328D; Sun, 9 May 2004 09:48:11 +0900 (JST) Date: Sun, 09 May 2004 09:48:01 +0900 (JST) Message-Id: <20040509.094801.74752827.yoriyuki@mbg.ocn.ne.jp> To: Christophe.Troestler@umh.ac.be Cc: briand@aracnet.com, caml-list@inria.fr Subject: Re: [Caml-list] interesting array efficiency observations From: Yamagata Yoriyuki In-Reply-To: <20040509.022535.116906186.Christophe.Troestler@umh.ac.be> References: <16541.9013.181806.9426@soggy.deldotd.com> <20040509.062138.71082875.yoriyuki@mbg.ocn.ne.jp> <20040509.022535.116906186.Christophe.Troestler@umh.ac.be> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 409D7FCD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 observations:01 yamagata:01 yoriyuki:01 yoriyuki:01 troestler:01 troestler:01 caml-list:01 observations:01 2004:99 yamagata:01 slower:01 inlined:01 ocamlopt:01 32,:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Christophe TROESTLER Subject: Re: [Caml-list] interesting array efficiency observations Date: Sun, 09 May 2004 02:25:35 +0200 (CEST) > On Sun, 09 May 2004, Yamagata Yoriyuki wrote: > > > > From: briand@aracnet.com > > > > > I was investigating the use of 1-D bigarray's vs Array and noticed > > > that the 1-D bigarray using c_layout seems to be slower than Array. > > > > Yes, it is expected, since a.{j} expands a call of a C function, while > > a.(j) expands inlined assembly codes. > > Is it? Ocamlopt does inline the call when the bigarray type is fully > known, doesn't it. Ah... You are right. Thanks. $ cat test.ml open Bigarray type t = (int32, int32_elt, c_layout) Array1.t let get (a:t) i = a.{i} $ cat test.s (... snip ...) Test__get_184: .L100: movl %eax, %edx .L101: movl young_ptr, %eax subl $12, %eax movl %eax, young_ptr cmpl young_limit, %eax jb .L102 leal 4(%eax), %eax movl $2303, -4(%eax) movl $int32_ops, (%eax) sarl $1, %ebx movl 20(%edx), %ecx cmpl %ebx, %ecx jbe .L104 movl 4(%edx), %ecx movl (%ecx, %ebx, 4), %ebx movl %ebx, 4(%eax) ret .L102: call caml_call_gc .L103: jmp .L101 .L104: call caml_array_bound_error .text .align 16 .globl Test__entry .type Test__entry,@function ------------------- 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