From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA05711; Sat, 11 Sep 2004 03:43:15 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 DAA02206 for ; Sat, 11 Sep 2004 03:43:13 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8B1hB2T026082; Sat, 11 Sep 2004 03:43:12 +0200 Received: from [192.168.1.200] (ppp210-32.lns2.syd3.internode.on.net [203.122.210.32]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i8B1h8HY059035; Sat, 11 Sep 2004 11:13:09 +0930 (CST) Subject: Re: [Caml-list] Gripes with array From: skaller Reply-To: skaller@users.sourceforge.net To: Damien Doligez Cc: caml users In-Reply-To: References: <200409090310.29295.jon@jdh30.plus.com> <200409091758.05679.jon@jdh30.plus.com> Content-Type: text/plain Message-Id: <1094866987.23076.132.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 11 Sep 2004 11:43:07 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4142582F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 damien:01 initialising:01 initialising:01 recursion:01 9660:01 glebe:01 arrays:01 arrays:01 unsafe:01 doligez:01 nsw:01 snail:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 2004-09-10 at 23:45, Damien Doligez wrote: > An intermediate solution would > be to make a "Array.unsafe_make" primitive, which would use memset > instead of initialising the array properly. Yeah but that doesn't solve the problem of filling the array initially with some 'non-binary-zero' value. You'd still need two passes: the memset and the proper fill (hence paging all the memory in twice). AFAICS tracking how much of an array is initialised with an index the GC can use costs a single comparison when you're not initialising arrays. EG: the GC has a list of blocks undergoing initialisation, determining the list is empty should be a single machine instruction. If you're initialising an array without any recursion, that's two comparisons. So the only time there would be a serious impact on the GC would be if you're initialising many big arrays all at once (EG if you're making a matrix as an array of arrays), and that cost would be small compared to scanning twice. I can't predict the performance of the one extra comparison needed when no arrays are being initialised because it probably depends on the processor cache design -- how much can one machine instruction + one memory reference cost? -- 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 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners