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 PAA13992; Fri, 10 Sep 2004 15:46:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA14373 for ; Fri, 10 Sep 2004 15:46:04 +0200 (MET DST) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8ADk3u1028508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 10 Sep 2004 15:46:03 +0200 Received: from spi.lip6.fr (spi.lip6.fr [132.227.83.193]) by isis.lip6.fr (8.12.11/jtpda-5.4+victor) with ESMTP id i8ADk3ls028753 for ; Fri, 10 Sep 2004 15:46:03 +0200 X-pt: isis.lip6.fr Received: from [132.227.83.219] (doligezportable.lip6.fr [132.227.83.219]) by spi.lip6.fr (8.11.6/jtpda-5.2) with ESMTP id i8ADjwg12145 for ; Fri, 10 Sep 2004 15:45:58 +0200 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <200409091758.05679.jon@jdh30.plus.com> References: <200409090310.29295.jon@jdh30.plus.com> <200409091758.05679.jon@jdh30.plus.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Gripes with array Date: Fri, 10 Sep 2004 15:45:55 +0200 To: caml users X-Mailer: Apple Mail (2.619) X-Scanned-By: isis.lip6.fr X-Miltered: at concorde with ID 4141B01B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 invariants:01 initialising:01 inlined:01 inlined:01 arrays:01 compiler:01 unsafe:01 christophe:01 doligez:01 doligez:01 sep:01 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sep 9, 2004, at 18:58, Jon Harrop wrote: >>> Also, can Array.init be made to fill the elements only once? >> No, that's impossible without breaking the GC invariants. > > Could it not even be done by dragging Array.init inside the compiler, > giving > it the same status as Array.make? Not without implementing such horrors as Christophe described. I don't much like the idea of introducing lots of bugs while slowing down the whole GC, even for programs that don't use arrays. An intermediate solution would be to make a "Array.unsafe_make" primitive, which would use memset instead of initialising the array properly. If you enter this as a feature wish in the BTS, I'll look into it. > Measuring memset from C gives me 0.0311secs. So element-setting must > be at > least 10% of Array.init. Also, the array_init function is surprisingly > fast, > presumably due to "f" not being inlined into Array.init but being > inlined > into array_init. That would confirm my intuition that the calls to f dominates the initialisation time. -- Damien ------------------- 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