From: Will M Farr <farr@MIT.EDU>
To: caml-list@inria.fr
Subject: Pervasives.{min,max} not specialized to floats by ocamlopt
Date: Thu, 17 Aug 2006 14:34:14 -0400 [thread overview]
Message-ID: <5EAC544C-8B6E-4004-B817-20190E868A3B@MIT.edu> (raw)
Hello all,
I was profiling some numerical code compiled with ocamlopt today (for
the record: PPC G4, Mac OS X 10.4.7, ocamlopt 3.09.2), and I noticed
that a lot of time was taken up in the compare_val function, even
though type inference asserted that all values I was comparing were
floats. Turns out the culprits were Pervasives.min and
Pervasives.max---these functions do not specialize to the appropriate
assembly instructions if their arguments are known to be floats.
Including my own min and max functions in the module to shadow these
removed the calls to compare_val. I'm curious if this is well-known
behavior (a google search didn't turn up anything). It's, of course,
not a bug, but it's definitely surprising when all the other
polymorphic comparisons are special-cased for floats!
I don't know how hard it would be to change this in ocamlopt, but it
seems like it would be pretty simple. If it is simple, it would be a
good candidate to change in the next release for those of us who do a
lot of float-comparing.
Thanks!
Will
next reply other threads:[~2006-08-18 14:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-17 18:34 Will M Farr [this message]
2006-08-18 15:34 ` [Caml-list] Pervasives.{min, max} " Olivier Andrieu
2006-08-18 15:37 ` Will M Farr
2006-08-18 15:43 ` Shawn
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=5EAC544C-8B6E-4004-B817-20190E868A3B@MIT.edu \
--to=farr@mit.edu \
--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).