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=0.0 required=5.0 tests=AWL 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 2B108BC6B for ; Mon, 23 Jul 2007 22:33:06 +0200 (CEST) Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6NKX5fK024451 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 23 Jul 2007 22:33:05 +0200 Received: from [80.229.56.224] (helo=beast.local) by pih-relay04.plus.net with esmtp (Exim) id 1ID4aW-0000re-Oo for caml-list@yquem.inria.fr; Mon, 23 Jul 2007 21:33:05 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Does the gc avoid collecting arrays of ints Date: Mon, 23 Jul 2007 21:23:52 +0100 User-Agent: KMail/1.9.7 References: <9d3ec8300707231035i5a218c16lb1bb1c11cac23e6d@mail.gmail.com> In-Reply-To: <9d3ec8300707231035i5a218c16lb1bb1c11cac23e6d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707232123.52470.jon@ffconsultancy.com> X-Miltered: at discorde with ID 46A51081.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; arrays:01 ocaml's:01 arrays:01 unboxed:01 pointers:01 atomically:01 traversing:01 hashtbl:01 memoizing:01 hash:01 hash:01 icfp:01 ocaml:01 ocaml:01 frog:98 On Monday 23 July 2007 18:35:40 Till Varoquaux wrote: > Looking at ocaml's source code I see that the values representing > arrays have a tag representing the type of their content (I'm guessing > boxed/unboxed). Does this mean that a bidimensional array containing > ints will only be explored in one direction during garbage collection? > If so, how do the compare to Bigarray's (I'm guessing they still are > slower). 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). 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 found this performance characteristic whilst optimizing Smoke's worst case performance, which is very important for such soft-real-time applications. I had "optimized" by memoizing stuff and things in a hash table, which turned out to slow the GC down enormously whenever it stumbled upon the hash table. Incidentally, I get the distinct impression that Chistophe's question isn't going to get answered until the ICFP is done and dusted and everyone has recouperated. ;-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/?e