From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 28AC2BC88 for ; Fri, 11 Feb 2005 01:55:54 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1B0trG8027473 for ; Fri, 11 Feb 2005 01:55:53 +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 BAA12920 for ; Fri, 11 Feb 2005 01:55:53 +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 j1B0tpRP024190 for ; Fri, 11 Feb 2005 01:55:52 +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 j1B0tTTG026265; Fri, 11 Feb 2005 11:25:44 +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: caml-list In-Reply-To: <014801c50f8e$a08e9a40$d54380d9@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> Content-Type: text/plain; charset=UTF-8 Message-Id: <1108083328.16698.189.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 11 Feb 2005 11:55:29 +1100 Content-Transfer-Encoding: 8bit X-Miltered: at nez-perce with ID 420C0299.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 420C0297.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 timings:01 ocaml:01 optimise:01 indexing:01 glebe:01 ric:98 hero:98 061:98 nsw:01 closure:02 snail:02 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 03:36, Frédéric Gava wrote: > Hi, > > > let test tablesize = > > let table = > > Array.init tablesize (fun i -> > > Array.init tablesize (fun j -> > > Array.create tablesize 0)) > > in > > for i = 0 to tablesize - 1 do > > for j = 0 to tablesize - 1 do > > for k = 0 to tablesize - 1 do > > table.(i).(j).(k) <- (i+1)*(j+1)*(k+1) > > done done done > Here, you have tablesize^2 applications and time to create the closure(s), > so it is not a good example. Why? o(2) is lots smaller than o(3). In my test case, a factor of 250 should show up in the timings. I also assumed, naively, Ocaml would use invariant code motion to optimise the triple indexing. > > [skaller@pelican] ~>time ./xmem 250 > > real 0m3.327s > > user 0m2.760s > > sys 0m0.300s > I do not understand what is "xmem". A super hero ;-) ? LOL! It's just the name of the program. The original one was 'mem' the modified one I called 'xmem'. -- 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