From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id EE453BC6B for ; Tue, 24 Jul 2007 12:23:55 +0200 (CEST) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.224]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6OANtuB003114 for ; Tue, 24 Jul 2007 12:23:55 +0200 Received: by wr-out-0506.google.com with SMTP id i21so1141703wra for ; Tue, 24 Jul 2007 03:23:54 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OeTtpMLxDruh+TDBRNJB/AQMTlM/ego1uK5LCDGMmT0mDgwP3RlVNhScPSgV27LMcbJB4On1AE0+EXKWnJRS2RvAK+gmxQylRkjDlm+HrcSxBV087K98FCb6tGStr1tPmQP9Luw7zHEUX5hkJZTClu8OdOLRCRoRPCJTRyBl0UY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FwRnCEGxsAbsqeOIO6upOrenA6hM5R0ThI6Yd9FNtfYYoBHe/9pgBy4CPmGMHRC4nob6vGkQIfhiG6J6eo4RtEOPjSP+XYNVsUsXDVFKyU9Vxd3J9zsXm9Ock/4UmA3qiffgd/qW1bpxdHrK2P3o5BnzGwHSDSOC1JEbl9er8hA= Received: by 10.142.226.2 with SMTP id y2mr309992wfg.1185272633997; Tue, 24 Jul 2007 03:23:53 -0700 (PDT) Received: by 10.143.168.5 with HTTP; Tue, 24 Jul 2007 03:23:53 -0700 (PDT) Message-ID: <9d3ec8300707240323u415c7ee4mec317a5cbe54e50e@mail.gmail.com> Date: Tue, 24 Jul 2007 12:23:53 +0200 From: "Till Varoquaux" To: "Jon Harrop" Subject: Re: [Caml-list] Does the gc avoid collecting arrays of ints Cc: caml-list@yquem.inria.fr In-Reply-To: <200707232123.52470.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9d3ec8300707231035i5a218c16lb1bb1c11cac23e6d@mail.gmail.com> <200707232123.52470.jon@ffconsultancy.com> X-j-chkmail-Score: MSGID : 46A5D33B.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46A5D33B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; arrays:01 arrays:01 indirections:01 bigarrays:01 bigarrays:01 pointers:01 atomically:01 traversing:01 hashtbl:01 ocaml:01 incremental:01 incremental:01 wrote:01 abstract:01 stack:01 On 7/23/07, Jon Harrop wrote: ... > > My gut feeling is that an array of arrays would be faster. You might also like > to abstract away a single array behind the interface of a multidimensional > array (particularly if you're on 64-bit). > Array of arrayrequier you two jump through two indirections (they are like **int instead of *int), bigarrays are based on a linear backend whatever there dimension may be. Using single dimension arrays and building an interface over it sounds like a good solution. I don't feel like I have the time to benchmark. For the record: I saw a tremendous performance boost going from two dimensional arrays of tupple of ints to tupples of bigarrays. By profilling I can tell I was loosing most of my time collecting local values. This was probably due to: _Manipulating a lot of tupples, wich needed to be collected. _Assigning local variables to rows. This was probably a bad idea to start with.. > However, there are some wierdnesses here. The GC treats the stack and arrays > of pointers atomically, traversing all elements in one go. So having a single > large array of boxed values (like an array of arrays or an array of lists in > a Hashtbl) can cause significant stalls in the incremental GC. I thought OCaml did not have an incremental GC, and that minor and major collections were both atomic. Till -- http://till-varoquaux.blogspot.com/