caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Monniaux <David.Monniaux@ens.fr>
To: Liste CAML <caml-list@inria.fr>
Subject: Pervasives.compare: slow?
Date: Mon, 19 Jun 2000 16:31:47 +0200 (MET DST)	[thread overview]
Message-ID: <Pine.GSO.4.03.10006191610270.1655-100000@basilic.ens.fr> (raw)

I used Pervasives.compare as a comparison function between hash values
(16-byte strings). Pervasives.compare is a polymorphic hack that works by
induction on the type information left for the garbage collector; even if
you specify Pervasives.compare : string -> string -> int, it still invokes
the polymorphic function.

There is apparently a 20-25% performance penalty using this form instead
of a simple comparison procedure for 16-byte strings. I suspect the
performance hit is even higher for more complex data structures.

Would it be possible to have ad hoc generated comparison functions? That
sounds like it needs including polytypic features into the language, which
is some very big stuff.

Perhaps including a String.compare function would be easier.

Regards,

David Monniaux            http://www.di.ens.fr/~monniaux
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France




             reply	other threads:[~2000-06-19 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-19 14:31 David Monniaux [this message]
2000-06-20  7:04 ` Judicael Courant
2000-06-23 12:31   ` Anton Moscal
2000-06-20 15:21 ` Xavier Leroy
2000-06-19 17:30 Ruchira Datta

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=Pine.GSO.4.03.10006191610270.1655-100000@basilic.ens.fr \
    --to=david.monniaux@ens.fr \
    --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).