From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: colanderman@gmail.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Performance of immediate objects
Date: Wed, 12 Jul 2006 09:51:24 +0900 (JST) [thread overview]
Message-ID: <20060712.095124.108739217.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <875c7e070607110710k2ca8d548i7f9d8e22d801df8e@mail.gmail.com>
From: "Chris King" <colanderman@gmail.com>
> Is there a substantial difference to the way in which
>
> class foo (i:int) = object
> val v = i
> method bar = v
> end
>
> let mk_foo i = new foo i
>
> and
>
> let mk_foo (i:int) = object
> val v = i
> method bar = v
> end
>
> are compiled? I've run a couple tests with the above and immediate
> objects seem to be about 15% slower than classes. Is this because a
> new method table is created for the immediate object every time or is
> that the case for classes also?
Certainly not. It would not be a 15% slowdown, but rather 10000%.
Initialization occurs only once, but one needs to check whether it was
done every time an object is created.
However, the 15% slowndown is for bytecode. For native code this is a
15% speedup. Guess which one we try to optimize.
Jacques Garrigue
next prev parent reply other threads:[~2006-07-12 0:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-11 14:10 Chris King
2006-07-12 0:51 ` Jacques Garrigue [this message]
2006-07-12 4:08 ` [Caml-list] " Chris King
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=20060712.095124.108739217.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=colanderman@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