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=3.4 required=5.0 tests=DNS_FROM_SECURITYSAGE, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 76C6CBBAF for ; Sun, 2 Nov 2008 13:00:36 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkMBAN8kDUlKfU4Yimdsb2JhbACCRZERPgEBAQoJDAcPBaoQiWIBBA X-IronPort-AV: E=Sophos;i="4.33,529,1220220000"; d="scan'208";a="19478259" Received: from ey-out-2122.google.com ([74.125.78.24]) by mail1-smtp-roc.national.inria.fr with ESMTP; 02 Nov 2008 13:00:36 +0100 Received: by ey-out-2122.google.com with SMTP id 6so763044eyi.15 for ; Sun, 02 Nov 2008 04:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:organization:to:subject:date :user-agent:references:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:message-id:from; bh=oYdVcr+ITK5dqhV1Dbfcjik0oFR682f5bSyda6P7BSI=; b=wmA5bUCcYLTMkVTkobBD4GNIolC2j83xRn2WV5iH/a4VvrmxIa9Vj4WJr1K1d2q+iX R/mhocZsTnS1LC4TKf3OJ2AJ4TaMaBvExhvZ7LSzl3wslw3br7EwlHl6ygVD5rV/Q4oH O8ZOsnc8rJW/MQW/6kPruJCE0+sQP992mc4LI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=organization:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:message-id:from; b=JZ3VJ2C/FMEf7evj/9B0FVcXNolIyBEtDRuOkjFARLOohbF+iakvyLFHoCkz/RtUSL J4uzzCwNGCr3hhYEkbJW4w9pbe+onxqyvz5cKgzDaz6xzwaAiCgtTpCTcGCeolVWYmPM tou8srfSX9lZLhxy3PEX6VJL9BR8yzHiMcad8= Received: by 10.210.51.10 with SMTP id y10mr7469013eby.98.1225627235603; Sun, 02 Nov 2008 04:00:35 -0800 (PST) Received: from leper.local ([87.115.78.230]) by mx.google.com with ESMTPS id t2sm11353056gve.5.2008.11.02.04.00.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 02 Nov 2008 04:00:34 -0800 (PST) Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Question about optimization Date: Sun, 2 Nov 2008 13:02:29 +0000 User-Agent: KMail/1.9.9 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200811021302.29629.jon@ffconsultancy.com> From: Jon Harrop X-Spam: no; 0.00; ocamlopt:01 -inline:01 -unsafe:01 cmxa:01 lablgl:01 lablgl:01 cmxa:01 lablglut:01 -unsafe:01 vectors:01 arrays:01 bool:01 ovh:98 hardcore:98 frog:98 On Sunday 02 November 2008 02:52:49 Micha=C5=82 C wrote: > Hi! > > I'm working on a physical based ray(path) tracer and the performance > is one of my top priorities (just after the image quality). > So I have a question about optimization: can You share some tips or > maybe optimizing strategies to improve the speed of programs? > > here is my code: http://neos1.ovh.org/ray3.ml, > > and here is how I compile it: > ocamlopt -inline 100 -unsafe -ffast-math str.cmxa -I +lablgl > lablgl.cmxa lablglut.cmxa -o ray ray.ml Looks good but get rid of -unsafe and use records to represent vectors inst= ead=20 of arrays and compile in 64-bit and get rid of -ffast-math. I don't know if it affects performance but get rid of conditions returning= =20 bool constants: if hc2 < 0. then false else true Should be: hc2 >=3D 0. > Maybe You can take a look, sure I don't expect You to look through it > in some hardcore way, but You know, maybe there are some obvious > mistakes or unnecessary boxing which will spot your eye. > > Thanks in advance, > oh and if you possibly want to see the development or how the program > works - http://neos1.wordpress.com May I have an example scene description file that I can use for profiling?= =20 Without it, I have no way to direct my effort... =2D-=20 Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e