caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Rajchenbach-Teller <David.Teller@ens-lyon.org>
To: Gerd Stolpmann <info@gerd-stolpmann.de>, Jordan W <jordojw@gmail.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Just how slow are classes?
Date: Fri, 18 Dec 2015 12:13:21 +0100	[thread overview]
Message-ID: <5673EA51.7020904@ens-lyon.org> (raw)
In-Reply-To: <1450436817.23408.54.camel@e130.lan.sumadev.de>

On 18/12/15 12:06, Gerd Stolpmann wrote:
> 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.

As a side-note, JS JIT engines manage rather well in most common cases,
despite the absence of inheritance. If my memory serves, JIT engines
manage to compile simple lookups to essentially a simple array access
(there's also need to check a tag, I don't remember if the tag is in a
fat pointer or if it needs a dereference).

> 
>>  For now, my primary question is: Just *how* slow are objects/classes?
>> Has there been any relevant benchmarking efforts that could shed some
>> light on this?
> 
> It is essentially an additional hash table lookup.

I thought that the OCaml compiler implemented inline caching in most
common cases?

Cheers,
 David

  reply	other threads:[~2015-12-18 11:13 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 [this message]
2015-12-18 11:19   ` Leo White

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=5673EA51.7020904@ens-lyon.org \
    --to=david.teller@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    --cc=jordojw@gmail.com \
    /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).