caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Brandon J. Van Every" <vanevery@indiegamedesign.com>
To: "caml" <caml-list@inria.fr>
Subject: RE: [Caml-list] Bigarray is a pig
Date: Sat, 24 Jul 2004 02:49:12 -0700	[thread overview]
Message-ID: <OOEALCJCKEBJBIJHCNJDOEJEHFAB.vanevery@indiegamedesign.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0407231554230.4202-100000@localhost.localdomain>

Brian Hurt wrote:
> Brand*n wrote:
> >
> > To C/C++ programmers interested in performance, this
> > defeats the purpose of using unboxed array elements.  If I
> > wanted to pay
> > function call overhead per element, for instance when
> > communicating with OpenGL, I'd simply call functions.
>
> Function calls aren't that expensive.

I'm pretty aware, from many years of experience, what the performance
characteristics of C/C++ arrays are vs. function call access to
comparable data, over millions of iterations.  Unless ocamlopt has a way
of avoiding EXTERN Bigarray declarations, we are talking about C code.

In other words, yes function calls are expensive in C compared to the
cost of just accessing an array element.

> A function call to a known function takes 1-2 clock cycles.

Not on any CPU I've worked on.  Generally speaking, you must save state
when you make function calls, and that is never a 1-2 clock cycle
operation.  If you have ways to inline stuff, great, but generally
speaking you can't do that with EXTERN C library stubs.  I don't know if
OCaml has great compiler technology that other languages don't have.
"It's not inlineable" is the drill in the C/C++ universe.


Cheers,                         www.indiegamedesign.com
Brand*n Van Every               S*attle, WA

Praise Be to the caml-list Bayesian filter! It blesseth
my postings, it is evil crap!  evil crap!  Bigarray!
Unboxed!  Overhead!  Wondering!  chant chant chant...


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-07-24  9:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-23 20:36 Brandon J. Van Every
2004-07-23 21:05 ` Brian Hurt
2004-07-24  9:49   ` Brandon J. Van Every [this message]
2004-07-23 21:05 ` Olivier Andrieu
2004-07-24  9:07   ` Brandon J. Van Every
2004-07-24  9:59     ` Marcin 'Qrczak' Kowalczyk
2004-07-25  9:09       ` David McClain
2004-07-24 10:39     ` Markus Mottl
2004-07-23 21:45 ` David McClain
2004-07-23 22:01 ` David McClain

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=OOEALCJCKEBJBIJHCNJDOEJEHFAB.vanevery@indiegamedesign.com \
    --to=vanevery@indiegamedesign.com \
    --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).