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 WAA00454; Mon, 4 Jun 2001 22:13:01 +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 WAA00606 for ; Mon, 4 Jun 2001 22:13:00 +0200 (MET DST) Received: from hall.mail.mindspring.net (hall.mail.mindspring.net [207.69.200.60]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f54KCxD29962 for ; Mon, 4 Jun 2001 22:12:59 +0200 (MET DST) Received: from dylan (1Cust147.tnt3.tucson.az.da.uu.net [63.11.144.147]) by hall.mail.mindspring.net (8.9.3/8.8.5) with SMTP id QAA29159 for ; Mon, 4 Jun 2001 16:12:52 -0400 (EDT) Message-ID: <002a01c0ed33$0b3d5de0$210148bf@dylan> From: "David McClain" To: References: <002f01c0ecf9$d028a3b0$210148bf@dylan> <15131.59080.327155.47983@beertje.william.bogus> Subject: Re: [Caml-list] OCaml Speed for Block Convolutions Date: Mon, 4 Jun 2001 13:15:00 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I can easily imagine that, with two caveats: tuples passed directly to > functions do seem to get elided, while on the other hand apparently > atomic float accumulators can cause more garbage than you might think. Actually, wherever I produce new data, I usually allocate an entirely new array to hold the results. Then I use unsafe accesses like the following for summing two arrays: let dst = Array.unsafe_create nel in for ix = 0 to pred nel do Array.unsafe_set dst ix ((Array.unsafe_get src1 ix) +. (Array.unsafe_get src2 ix)) done; I think the constant creation of new arrays to hold intermediate results (i.e., immutable data) is costing too much. Many of the intermediate values could be overwritten in place and save a lot of time. ... of course... don't ask how long it took to write all this stuff in the inner loops of the convolution in C, nor how long it took to debug that stuff.... And immutable data definitely helps to get the code correct. OCaml still rules! - DM ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr