caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David McClain" <barabh@qwest.net>
To: <caml-list@inria.fr>
Subject: Re: [Caml-list] Array Optimizations
Date: Wed, 7 Nov 2001 13:10:45 -0700	[thread overview]
Message-ID: <004901c167c8$48c450f0$210148bf@dylan> (raw)
In-Reply-To: <3BE94320.26654.1BF88274@localhost>


> P.S.: At the moment I write a wrapper for interfacing with a subset of
FFTW.
> I use Bigarray float64 as a complex array with re(i) = v.{2*i} and
im(i)=v.{2*i+1}.
> Does anybody have a better idea?

FWIW, some time ago (a couple of years perhaps) I was faced with this
decision, and more, in terms of interfacing to foreign numeric code and
Matlab. As it happens, Matlab likes to allocate complex arrays as separate
arrays of real and imaginary components. That may simplify some of their
numeric coding, but I found that on PII and PIII architectures, the
performance suffers tremendously due to cache thrashing. Better to use
adjacent real and imaginary components.

When I did the adjacent real and imaginary components, I did it just like
you ask about above. What I find is that the OCaml performance, even with
this doubling and offset by one, indexing is quite good. Especially
important is to precompute these indices in the event of several array
accesses inside of "for" loops. That helps enormously. My OCaml speeds
indicate performance better than C/C++ coded internals in languages like
RSI/IDL, by almost 2x. One can only wonder about the quality of the C/C++
code against which I was comparing -- that was out of my control.

- David McClain
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


      reply	other threads:[~2001-11-08 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-05 21:11 Christophe TROESTLER
2001-11-06 15:51 ` Thorsten Ohl
2001-11-07 12:20 ` Rolf Wester
2001-11-07 20:10   ` David McClain [this message]

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='004901c167c8$48c450f0$210148bf@dylan' \
    --to=barabh@qwest.net \
    --cc=caml-list@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).