caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] floating point performance
@ 2001-05-30  8:29 Tom _
  2001-05-30 19:06 ` Chris Hecker
  0 siblings, 1 reply; 2+ messages in thread
From: Tom _ @ 2001-05-30  8:29 UTC (permalink / raw)
  To: caml-list

I have ported some numerical code from SML to O'Caml.
It seems to perform about about 1/5th the speed of
equivalent C code if I use "float array".  I did
look at the FAQ and at the numerical OCAML web
page at Inria, and found them helpful.

Using -unsafe didn't make a big difference, and
neither did eliminating the obvious sources of
consing. 

I'm probably still consing in a number of 
places, but I can't get a good handle of 
what to do about it or which parts matter. 
Is there some way of getting a 
measure of the amount of consing that happens in a 
section of code?

The web page says that the O'Caml compiler will box
floating point numbers if I use recursive calls; is
that still true for tail recursive calls to functions
that are visible only locally?  It would seem that
that transformation should be pretty easy.

Is there a chance that using the new native types
would help?  How do they interact with tail recursive
calls?

Also, using Bigarray costs a factor of 3 in speed
compared to otherwise identical code.  The profiler
suggests that subscripting isn't getting inlined.
Is there some way of getting faster performance out
of Bigarray?

Thanks in advance for any hints you can offer.
If anybody is interested in taking a look, I can
send them the code separately.

Cheers,
Thomas.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] floating point performance
  2001-05-30  8:29 [Caml-list] floating point performance Tom _
@ 2001-05-30 19:06 ` Chris Hecker
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Hecker @ 2001-05-30 19:06 UTC (permalink / raw)
  To: Tom _, caml-list


A topic that is dear to my heart.  I haven't done any nontrivial profiling on my application yet, though, so my advice is currently limited.

>Also, using Bigarray costs a factor of 3 in speed
>compared to otherwise identical code.  The profiler
>suggests that subscripting isn't getting inlined.
>Is there some way of getting faster performance out
>of Bigarray?

One thing I noticed is that if the types are at all generalized, the Bigarray.{} accesses aren't inlined.  So, my code looks like this:

type ba2d = (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array2.t
type ba1d = (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t

let mult (a : ba2d) (x : ba1d) =  etc.

If the code's not too big, and you've got the identical C version, I'd like to see it.

Chris

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-30 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-30  8:29 [Caml-list] floating point performance Tom _
2001-05-30 19:06 ` Chris Hecker

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).