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=1.3 required=5.0 tests=SPF_FAIL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E5652BC0B for ; Thu, 28 Dec 2006 20:50:06 +0100 (CET) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBSJo5VI018509 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 28 Dec 2006 20:50:06 +0100 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1H01GM-0005Qa-2t for caml-list@inria.fr; Thu, 28 Dec 2006 20:50:02 +0100 Received: from dslb-084-058-076-164.pools.arcor-ip.net ([84.58.76.164]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 Dec 2006 20:50:02 +0100 Received: from manfred.lotz by dslb-084-058-076-164.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 Dec 2006 20:50:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Manfred Lotz Subject: Re: Question on writing efficient Ocaml. Date: Thu, 28 Dec 2006 20:24:40 +0100 Message-ID: <20061228202440.aefec714.manfred.lotz@yahoo.de> References: <20061203110003.6804FBC6A@yquem.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-058-076-164.pools.arcor-ip.net In-Reply-To: X-Mailer: Sylpheed version 2.2.10 (GTK+ 2.10.6; i386-portbld-freebsd6.2) X-Newsreader: Sylpheed version 2.2.10 (GTK+ 2.10.6; i386-portbld-freebsd6.2) Sender: news X-Miltered: at discorde with ID 45941FEE.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 ocamlopt:01 -noassert:01 -unsafe:01 -noassert:01 -unsafe:01 wrote:01 assertions:01 binary:01 algorithm:01 bounds:02 hotmail:97 -ccopt:03 -ccopt:03 On Thu, 28 Dec 2006 11:42:04 +0000 "Ian Oversby" wrote: > Hi, > > Apologies if this is the wrong forum in which to ask this question. > Is there anywhere else more > suitable? > > I've written some Ocaml code to solve the problem of placing 8 queens > on a board so that none of them attack each-other. I've also written > a C++ equivalent which is running much more quickly than the Ocaml. > I assume I've made some basic errors with the Ocaml - does anyone > have any suggestions as to what? > > The code is available here: > > http://curiousprogrammer.wordpress.com/2006/12/22/speed-comparison-plt-scheme-ocaml-and-c/ > > I compiled the Ocaml with the following command: > > ocamlopt -noassert -unsafe -ccopt -O3 -ccopt -fomit-frame-pointer > q.ml -o q.exe > I personally don't believe that it is a good idea to use options like: -noassert -unsafe -ccopt -O3 -ccopt -fomit-frame-pointer I regard bounds checkings and assertions as good features of Ocaml and not as something to avoid in order to achieve good performances. It is more important to have a stable binary. If you want to speed up it is a matter of using a good algorithm. -- Manfred