caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Leo White <leo@lpw25.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Just how slow are classes?
Date: Fri, 18 Dec 2015 06:19:24 -0500	[thread overview]
Message-ID: <1450437564.2699612.470934465.2C17EF54@webmail.messagingengine.com> (raw)
In-Reply-To: <1450436817.23408.54.camel@e130.lan.sumadev.de>

> > While I am also curious why "nice cases" of objects/classes couldn't
> > be optimized (perhaps some link time check), when most of the objects
> > adhere to a nice hierarchy, I would like to defer that discussion
> > until another time.
> 
> Oh, this is quickly explained. There is no hierarchy at runtime you can
> exploit. Remember that object X can be a subtype of object Y even if
> there is no inheritance relationship. This is very different from other
> OO languages.
> 

It is worth noting that you get similar issues with things like Java interfaces
(you can think of every method in an OCaml object type as a Java interface
containing a single method), and there are some effective mechanisms for
optimising them. The most important of these is inline method caching, which
is implemented for OCaml objects. Others, such as perfect hashing[1] are not
implemented for OCaml, so there is probably room for improvement, but they
would require significant amounts of work.

Regards,

Leo

[1] http://www.lirmm.fr/~ducour/Publis/RD-TOPLAS-08.pdf

      parent reply	other threads:[~2015-12-18 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18  8:19 Jordan W
2015-12-18 11:06 ` Gerd Stolpmann
2015-12-18 11:13   ` David Rajchenbach-Teller
2015-12-18 11:19   ` Leo White [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=1450437564.2699612.470934465.2C17EF54@webmail.messagingengine.com \
    --to=leo@lpw25.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).