From: Jon Harrop <jonathandeanharrop@googlemail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Question about optimization
Date: Sun, 2 Nov 2008 15:52:12 +0000 [thread overview]
Message-ID: <200811021552.12185.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,
Now that I can profile it, the single biggest problem is obviously that seven
of my cores are idle!
You have manually un-nested pattern matches which is not necessary. For
example, this:
| Leaf (prim, mat) ->
match prim with
| Triangle (tri) -> ray_triangle ro rd tri
| Sphere (sph) -> ray_sphere ro rd sph
May be written:
| Leaf (Triangle tri, mat) -> ray_triangle ro rd tri
| Leaf (Sphere sph, mat) -> ray_sphere ro rd sph
The only obvious optimizations I can see are to use a faster random number
generator and to inline the vector arithmetic by hand.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
next prev parent reply other threads:[~2008-11-02 14:50 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
2008-11-02 15:52 ` Jon Harrop [this message]
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=200811021552.12185.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