From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 19E2ABC88 for ; Fri, 11 Feb 2005 14:04:48 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1BD4lXN023150 for ; Fri, 11 Feb 2005 14:04:47 +0100 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 OAA08022 for ; Fri, 11 Feb 2005 14:04:47 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1BD4j4B023143 for ; Fri, 11 Feb 2005 14:04:46 +0100 Received: from [192.168.1.200] (ppp212-197.lns2.syd3.internode.on.net [203.122.212.197]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j1BD4WmQ041549; Fri, 11 Feb 2005 23:34:43 +1030 (CST) Subject: Re: [Caml-list] Memory allocation nano-benchmark. From: skaller Reply-To: skaller@users.sourceforge.net To: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Gava Cc: Christian Szegedy , caml-list In-Reply-To: <002401c5101b$4130b640$a2f40b50@mshome.net> References: <420B7A7E.90504@or.uni-bonn.de> <005101c50f7f$6db0e560$d54380d9@mshome.net> <1108048745.16698.101.camel@pelican.wigram> <014801c50f8e$a08e9a40$d54380d9@mshome.net> <015f01c50f99$e8a57e60$d54380d9@mshome.net> <420BBC7D.5070103@t-online.de> <002401c5101b$4130b640$a2f40b50@mshome.net> Content-Type: text/plain; charset=UTF-8 Message-Id: <1108127068.16698.320.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 12 Feb 2005 00:04:32 +1100 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 420CAD6F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 420CAD6D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 gava:01 wrote:01 'real':01 bigarray:01 glebe:01 ric:98 paging:98 061:98 nsw:01 snail:02 2037:02 programming:03 perhaps:03 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Fri, 2005-02-11 at 20:22, Frédéric Gava wrote: > > You could write; > for i=0 to tablesize -1 do > let row1 = table.(i) in > for j=0 to tablesize -1 do > let row2 = row1.(j) do > for k=0 to tablesize -1 do > row2.(k) <- (i+1)*(j+1)*(k+1) > done done done > > and peraps you will have a faster code. I found no difference, here are two runs: [skaller@pelican] ~>time ./zmem 250 real 0m3.110s user 0m2.820s sys 0m0.240s [skaller@pelican] ~>time ./zmem 250 real 0m27.732s user 0m2.750s sys 0m0.340s The huge 'real' time there is VM paging. Perhaps Xavier will bless us with a comment as to whether invariant code motion optimisation is actually done in table.(i).(j).(k) <- (i+1)*(j+1)*(k+1) Using bigarray (c_layout): real 0m27.948s user 0m0.770s sys 0m0.500s .. 4 times faster. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net