caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jonathandeanharrop@googlemail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Question about optimization
Date: Sun, 2 Nov 2008 13:02:29 +0000	[thread overview]
Message-ID: <200811021302.29629.jon@ffconsultancy.com> (raw)
In-Reply-To: <BDD33495-2267-4A95-8C60-ACB2979E450D@gmail.com>

On Sunday 02 November 2008 02:52:49 Michał 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 instead 
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 
bool constants:

  if hc2 < 0. then false else true

Should be:

  hc2 >= 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? 
Without it, I have no way to direct my effort...

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


  parent reply	other threads:[~2008-11-02 12:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-02  2:52 Michał C
2008-11-02 12:23 ` [Caml-list] " Peng Zang
2008-11-02 13:02 ` Jon Harrop [this message]
2008-11-02 15:52 ` Jon Harrop
2016-04-21  7:13 [Caml-list] Question about Optimization Gregory Malecha
2016-04-21  9:32 ` Jonas Jensen
2016-04-21 11:45   ` Yaron Minsky
2016-04-21 15:45     ` Gregory Malecha
2016-04-21 16:02       ` Gabriel Scherer
2016-04-21 16:05         ` Daniel Bünzli
2016-04-21 16:35           ` Ben Millwood
2016-04-22 16:09             ` Gregory Malecha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200811021302.29629.jon@ffconsultancy.com \
    --to=jonathandeanharrop@googlemail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).