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 HAA09468; Tue, 11 May 2004 07:04:19 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA09052 for ; Tue, 11 May 2004 07:04:17 +0200 (MET DST) From: briand@aracnet.com Received: from citrine.spiritone.com (citrine.spiritone.com [216.99.193.133]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4B54FSH019066 for ; Tue, 11 May 2004 07:04:16 +0200 Received: from soggy.deldotd.com (216-99-206-32.cust.aracnet.com [216.99.206.32]) by citrine.spiritone.com (8.12.10/8.12.8) with ESMTP id i4B54EOt009082; Mon, 10 May 2004 22:04:14 -0700 Received: from briand by soggy.deldotd.com with local (Exim 3.36 #1 (Debian)) id 1BNPR8-0000XW-00; Mon, 10 May 2004 22:04:14 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16544.24269.920791.984825@soggy.deldotd.com> Date: Mon, 10 May 2004 22:04:13 -0700 To: malc Cc: caml-list@inria.fr Subject: Re: [Caml-list] interesting array efficiency observations In-Reply-To: References: <16541.9013.181806.9426@soggy.deldotd.com> X-Mailer: VM 6.92 under Emacs 21.2.1 X-Miltered: at concorde with ID 40A05ECF.001 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 compiles:01 elt:01 monomorphic:01 ocamlopt:01 malc:01 malc:01 pulsesoft:01 2004:99 slower:01 ifi:01 prev:01 diso-:99 selm:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Perfect. Thanks for the link. However, I have a question :-) >>From the link: let f a x y = 1 + a.{x,y} has a polymorphic type (int, 'a, 'b) Bigarray.Array2.t -> int -> int -> int and compiles down to a library function call. However, open Bigarray let f (a : (int, int_elt, c_layout) Array2.t) x y = 1 + a.{x,y} is monomorphic and will be compiled much more efficiently by ocamlopt. So what if I have declared a variable, i.e. let the_a = Bigarray.Array2.create Bigarray.float64 Bigarray.c_layout 5 5;; and now I invoke f f the_a 1 2 Why would the_a be treated polymorphically ?? the_a is very clearly defined as a very specific Bigarray and so the compiler will know this in the call to f, and will do the correct thing, right ? Isn't the type annotation in the function redundant in such a case ? Thanks Brian >>>>> "malc" == malc writes: malc> On Sat, 8 May 2004 briand@aracnet.com wrote: >> 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. malc> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=ISO-8859-1&threadm=fa.hj2u7jv.t1ms25%40ifi.uio.no&rnum=1&prev=/groups%3Fq%3Dfa.caml%2Bbigarray%2Bmalc%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DISO-8859-1%26selm%3Dfa.hj2u7jv.t1ms25%2540ifi.uio.no%26rnum%3D1 malc> -- mailto:malc@pulsesoft.com ------------------- 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