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 MAA09240; Tue, 5 Jun 2001 12:48:08 +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 MAA09242 for ; Tue, 5 Jun 2001 12:48:07 +0200 (MET DST) Received: from web11902.mail.yahoo.com (web11902.mail.yahoo.com [216.136.172.186]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f55Am5n29680 for ; Tue, 5 Jun 2001 12:48:06 +0200 (MET DST) Message-ID: <20010605104804.83767.qmail@web11902.mail.yahoo.com> Received: from [24.221.171.193] by web11902.mail.yahoo.com; Tue, 05 Jun 2001 03:48:04 PDT Date: Tue, 5 Jun 2001 03:48:04 -0700 (PDT) From: Tom _ Subject: Re: [Caml-list] OCaml Speed for Block Convolutions To: caml-list@inria.fr In-Reply-To: <15131.59080.327155.47983@beertje.william.bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > let a = ref 0. in > for i = 0 to n-1 do > a := !a +. Array.unsafe_get xs i > done I think it's natural for this to cause storage allocation. After all, "ref 0." is an object that can be passed around. The compiler may be able to infer that it can allocate it on the stack, but that may be hard in general. Why not have a construct that expresses what the programmer really wants: let mutable a = 0. in for i = 0 to n-1 do a <- a +. Array.unsafe_get xs i done Tom PS: sorry if you have seen this posting before; I think I keep hitting the wrong button in my mailer and end up not responding to the list __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr