[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-07-12 (00:48) |
From: | Jacques Garrigue <garrigue@m...> |
Subject: | Re: [Caml-list] Performance of immediate objects |
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