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 231F3BC88 for ; Thu, 10 Feb 2005 17:34:18 +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 j1AGYHEg021214 for ; Thu, 10 Feb 2005 17:34:17 +0100 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 RAA26646 for ; Thu, 10 Feb 2005 17:34:17 +0100 (MET) Received: from smtp10.wanadoo.fr (smtp10.wanadoo.fr [193.252.22.21]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1AGYHhj005958 for ; Thu, 10 Feb 2005 17:34:17 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1003.wanadoo.fr (SMTP Server) with ESMTP id 0495C20002F2 for ; Thu, 10 Feb 2005 17:34:17 +0100 (CET) Received: from nono (ARouen-106-1-2-213.w217-128.abo.wanadoo.fr [217.128.67.213]) by mwinf1003.wanadoo.fr (SMTP Server) with SMTP id A38B4200033F for ; Thu, 10 Feb 2005 17:34:16 +0100 (CET) X-ME-UUID: 20050210163416670.A38B4200033F@mwinf1003.wanadoo.fr Message-ID: <014801c50f8e$a08e9a40$d54380d9@mshome.net> From: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Gava?= Cc: "caml-list" References: <420B7A7E.90504@or.uni-bonn.de> <005101c50f7f$6db0e560$d54380d9@mshome.net> <1108048745.16698.101.camel@pelican.wigram> Subject: Re: [Caml-list] Memory allocation nano-benchmark. Date: Thu, 10 Feb 2005 17:36:09 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Miltered: at concorde with ID 420B8D09.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 420B8D09.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; gava:01 gava:01 caml-list:01 arrays:01 closures:01 cheers:01 ric:98 hero:98 ric:98 closure:02 frederic:03 sys:03 let:03 let:03 problem:05 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: 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. Peraps test the following code (I do not have test it) let tmp1=Array.create tablesize 0 in let tmp2 = Array.create tablesize (Array.copy tmp1) in let table = Array.create tablesize (Array.copy tmp2) 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 (copy are used to not have the same arrays ) I think (not sure) that used "Array.create" instead of "Array.init" allows ours to not have the problem of buildings the closures and peraps give a faster code (for this cases). To test ;-) > [skaller@pelican] ~>time ./xmem 250 > real 0m3.327s > user 0m2.760s > sys 0m0.300s I do not understand what is "xmem". A super hero ;-) ? Cheers, Frédéric Gava