From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 391B6BC0B for ; Thu, 28 Dec 2006 23:28:53 +0100 (CET) Received: from ptb-relay02.plus.net (ptb-relay02.plus.net [212.159.14.213]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBSMSql0016676 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 28 Dec 2006 23:28:53 +0100 Received: from [80.229.56.224] (helo=[10.0.0.5]) by ptb-relay02.plus.net with esmtp (Exim) id 1H03k3-0005XH-SU for caml-list@yquem.inria.fr; Thu, 28 Dec 2006 22:28:52 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Question on writing efficient Ocaml. Date: Thu, 28 Dec 2006 22:23:37 +0000 User-Agent: KMail/1.9.5 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612282223.37905.jon@ffconsultancy.com> X-Miltered: at discorde with ID 45944524.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 unboxing:01 ocaml:01 higher-level:01 solver:01 optimising:01 frog:98 wrote:01 caml-list:01 caml:02 caml:02 inefficient:02 objective:02 constructs:02 fewer:02 On Thursday 28 December 2006 16:03, Ian Oversby wrote: > Does this mean that unboxing is inefficient in OCaml? Yes. However, you've had to go out of your way to make the OCaml slow in this case. > I've written an > alternative version of the C++ that returns NULL instead of out of bound > values which was close to the same speed so it would be a little > disappointing if I couldn't achieve something similar in OCaml with Some / > None. You would be better off focusing on higher-level optimisations, like algorithmic optimisations. > >You might want to compare with this solution of the queens problem in > >ocaml: > > http://caml.inria.fr/pub/old_caml_site/Examples/oc/basics/queens.ml > > I've written a queens solver along the same lines which is much faster than > my other example as it makes many fewer calls and constructs fewer (and > simpler) boards. Why are you optimising this version if you already have a faster one? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists