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 AAA30322; Thu, 13 May 2004 00:57:14 +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 AAA29559 for ; Thu, 13 May 2004 00:57:12 +0200 (MET DST) Received: from xizor.is.scarlet.be (xizor.is.scarlet.be [193.74.71.21]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4CMvBEV017203 for ; Thu, 13 May 2004 00:57:11 +0200 Received: from (u212-239-155-55.freedom.planetinternet.be [212.239.155.55]) by xizor.is.scarlet.be with ESMTP id i4CMv1q03171; Thu, 13 May 2004 00:57:01 +0200 Received: from poincare ([127.0.0.1] helo=localhost ident=trch) by poincare with esmtp (Exim 3.36 #1 (Debian)) id 1BNvh1-0000Lo-00; Wed, 12 May 2004 17:30:47 +0200 Date: Wed, 12 May 2004 17:30:46 +0200 (CEST) Message-Id: <20040512.173046.97302939.Christophe.Troestler@umh.ac.be> To: briand@aracnet.com Cc: malc@pulsesoft.com, caml-list@inria.fr Subject: Re: [Caml-list] interesting array efficiency observations From: Christophe TROESTLER In-Reply-To: <16544.24269.920791.984825@soggy.deldotd.com> References: <16541.9013.181806.9426@soggy.deldotd.com> <16544.24269.920791.984825@soggy.deldotd.com> Organization: Universite de Mons-Hainaut X-URL: http://www.umh.ac.be/math/an/ X-Spook: freedom FSF Serbian USCOI Ceridian morse government JUWTF Cohiba SCUD missile X-Mailer-URL: http://www.mew.org/ X-Operating-System: GNU/Linux (http://www.linux.org/) X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Mailer: Mew version 4.0.61 on Emacs 21.3.1 / 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 40A2ABC7.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 troestler:01 troestler:01 compiles:01 monomorphic:01 inlining:01 inlined:01 inlined:01 compiler:01 chris:01 bigarray:01 bigarray:01 christophe:01 christophe:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 10 May 2004, briand@aracnet.com wrote: > > 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. > > let the_a = Bigarray.Array2.create Bigarray.float64 Bigarray.c_layout 5 5;; > > f the_a 1 2 > > Why would the_a be treated polymorphically ?? The function [f] _could_ be specialized when applied to a monomorphic type. However, when do you do that: when you define the function (but then you end up compiling [f] for all combinations of 'a and 'b...) or when the function is applied (a kind of function inlining)? The first solution is not that nice (unnecessary increase of code size) but I have a question for the second: Is it possible that [f] be inlined and then specialized or the compiler does not do that? This question also holds for, e.g. [min (f x) (g x)], may [min] be inlined and then specialized if it is known for example that [f x] and [g x] are [int]? Cheers, ChriS ------------------- 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