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 KAA22093; Sun, 9 May 2004 10:24:31 +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 KAA20624 for ; Sun, 9 May 2004 10:24:30 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i498OPSH028179; Sun, 9 May 2004 10:24:25 +0200 Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA22112; Sun, 9 May 2004 10:24:24 +0200 (MET DST) Date: Sun, 9 May 2004 10:24:24 +0200 From: Xavier Leroy To: briand@aracnet.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] interesting array efficiency observations Message-ID: <20040509102424.A22305@pauillac.inria.fr> References: <16541.9013.181806.9426@soggy.deldotd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <16541.9013.181806.9426@soggy.deldotd.com>; from briand@aracnet.com on Sat, May 08, 2004 at 11:13:09AM -0700 X-Miltered: at concorde with ID 409DEAB9.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 slower:01 generic:01 -dimensional:01 indirection:01 arrays:01 bigarray:01 bigarray:01 bytecode:01 polymorphic:01 native:02 inline:03 inline:03 compiling:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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. > Is this an expected result ? Yes. When compiling to bytecode (or at the top-level), all bigarray accesses go through a generic access function that is polymorphic over the number of dimensions, the array type and the array layout, and is therefore somewhat expensive. When compiling to native code, efficient inline code is generated instead for accesses to 1, 2 and 3-dimensional arrays, provided the full type of the bigarray (including layout and element type) is known. In this case, the inline access code is almost as efficient as that for accessing a regular array: just one extra indirection. - Xavier Leroy ------------------- 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