caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] OCaml image blending performance
Date: Thu, 7 Feb 2008 15:04:24 +0000	[thread overview]
Message-ID: <200802071504.24169.jon@ffconsultancy.com> (raw)
In-Reply-To: <20080207110154.GA24561@annexia.org>

On Thursday 07 February 2008 11:01:54 Richard Jones wrote:
> On Wed, Feb 06, 2008 at 11:34:02PM +0000, Jon Harrop wrote:
> > In this case, most of the speed loss can be regained by simply
> > aggressively inlining everything, which is exactly what you (ab)used
> > C macros for in the C code.
>
> I don't understand this.  In 'blend2.ml' (which I was responsible for)
> C macros are used to inline all the OCaml functions the same as in the
> C version.  Yet it's still 70% slower than the C version.
>
> My suspicion was that it was to do with his use of a string as a byte
> array.

I suspect OCaml's 31-bit integers are responsible for the remaining slowdown. 
You might try using 32-bit integers (Int32) but I'm not sure ocamlopt will 
unbox them as aggressively as it does floats (I've never tried it).

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


  parent reply	other threads:[~2008-02-07 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 20:29 Ilmari Heikkinen
2008-02-06 22:12 ` [Caml-list] " Pal-Kristian Engstad
2008-02-06 23:30   ` Jon Harrop
2008-02-06 23:34 ` Jon Harrop
2008-02-07 11:01   ` Richard Jones
2008-02-07 11:13     ` Dominique Martinet
2008-02-07 12:29     ` Mauricio Fernandez
2008-02-07 15:04     ` Jon Harrop [this message]
     [not found] ` <854c25eb0802070607t4b2ed641xa3bc19e8384ce23@mail.gmail.com>
2008-02-07 14:10   ` Ilmari Heikkinen
2008-02-07 14:08     ` Jon Harrop

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=200802071504.24169.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.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).