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 SAA10605; Sun, 12 Sep 2004 18:07:43 +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 SAA11798 for ; Sun, 12 Sep 2004 18:07:42 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8CG7gYf004756 for ; Sun, 12 Sep 2004 18:07:42 +0200 Received: from bourg.inria.fr (bourg.inria.fr [128.93.11.100]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA12079 for ; Sun, 12 Sep 2004 18:07:42 +0200 (MET DST) Received: from basile by bourg.inria.fr with local (Exim 4.34) id 1C6Wsh-0000M8-TM for caml-list@inria.fr; Sun, 12 Sep 2004 18:07:11 +0200 Date: Sun, 12 Sep 2004 18:07:11 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] Gripes with array Message-ID: <20040912160711.GA1292@bourg.inria.fr> References: <200409090310.29295.jon@jdh30.plus.com> <200409111536.10902.jon@jdh30.plus.com> <200409121633.38389.jon@jdh30.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <200409121633.38389.jon@jdh30.plus.com> User-Agent: Mutt/1.5.6+20040818i From: "Basile Starynkevitch [local]" X-Miltered: at nez-perce with ID 4144744E.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 basile:01 basile:01 2004:99 non-float:01 initializing:01 optimising:01 ocamlopt:01 run-time:01 ocamlrun:01 productive:01 cristal:01 cristal:01 ocaml:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, Sep 12, 2004 at 04:33:38PM +0100, Jon Harrop wrote: > > Having said that, it might be possible to abstract the array lookup and > replace it with a clever function to work out where the "i"th element really > is. Then you could give Array.init a continuation. Hmm... > > > > Could you add a memset to String.create though? :-) > > > > String.make > > I meant for safety reasons - either don't export String.create or make it > safe, e.g. "let create n = make n '\000'". > > > > An array_init2 function which specialises the array type but uses an > > > external > > > "f" function betters the time taken by Array.init by ~36% (perhaps not > > > significantly different): > > > > That's from getting rid of the float/non-float test. Nothing to do with > > the cost of initializing twice. > > Yes. Optimising that would be much more productive. Am I right in thinking > that ocamlopt doesn't hoist the test out of the loop? > Such optimisations would be best done at run-time, e.g. by Basile's > JIT. Where is he? ;-) I'm here (not for very long, I'm going back in a few days to CEA working on other things, probably unrelated to Ocaml). However, this optimisation is not for OcamlJIT, which is an unoptimizing JIT. The main requirement of OcamlJIT was full compatibility with Ocamlrun without touching a single line in the ocaml/**/*.ml* sources (the ** is zsh notation) of Ocaml (actually, I had to cheat for the toplevel where I added a single line, now incorporated in 3.08). Of course, one could dream of substantially change the bytecode instruction set (for better JIT translation). But it won't be compatible with Ocaml. If you ask me, the one feature I would have liked in the bytecode instruction set, is to add a LABEL bytecode, followed by a useless word (used by ocamljit to store a pointer to machine code), and to change the bytecode generator so that every closure had its code pointer pointing to this LABEL bytecode. But the rule of the OcamlJIT game was to leave Ocaml as much as possible unchanged. BTW, I would be delighted to have feedback of people using OcamlJit with Ocaml 3.08. Regards -- Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr other email : basile at starynkevitch dot net Project cristal.inria.fr - for a few days http://cristal.inria.fr/~starynke --- all opinions are only mine ------------------- 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