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 WAA16335; Fri, 23 Jul 2004 22:57:41 +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 WAA14564 for ; Fri, 23 Jul 2004 22:57:40 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6NKvcSH019375 for ; Fri, 23 Jul 2004 22:57:38 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i6NKvYo02741; Fri, 23 Jul 2004 15:57:34 -0500 (CDT) Date: Fri, 23 Jul 2004 16:05:16 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: "Brandon J. Van Every" cc: caml Subject: Re: [Caml-list] Bigarray is a pig In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 41017BC2.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 brandon:99 unboxed:01 selm:01 prematurely:01 prev:01 fhl:99 bigarray:01 bigarray:01 ocaml:01 groups:01 groups:01 checking:01 opengl:02 arch:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 23 Jul 2004, Brandon J. Van Every wrote: > I have been looking at the sources of the Bigarray implementation. I am > chagrined to discover that not only does Bigarray cost a function call > per array element access, but a number of additional piggish things > happen per access. If memory serves, Ocaml can optimize the access if the size and type are known, getting rid of the function call overhead and type specialization. I don't think it gets rid of the bounds checking, tho- which is good. Can someone who actually knows what is going on clarify this? > To C/C++ programmers interested in performance, this > defeats the purpose of using unboxed array elements. If I wanted to pay > function call overhead per element, for instance when communicating with > OpenGL, I'd simply call functions. Function calls aren't that expensive. From comments in other forums: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=cdjsuj%24cs6%241%40wolfberry.srv.cs.cmu.edu may I respectfully suggest that you are prematurely optimizing? A function call to a known function takes 1-2 clock cycles. A cache miss, on the other hand, can take hundreds of clock cycles: http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=45022fc8.0407221624.6fd81ad0%40posting.google.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.arch -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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