Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Performance of immediate objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-07-11 (14:10)
From: Chris King <colanderman@g...>
Subject: Performance of immediate objects
Is there a substantial difference to the way in which

class foo (i:int) = object
 val v = i
 method bar = v

let mk_foo i = new foo i


let mk_foo (i:int) = object
 val v = i
 method bar = v

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?

- Chris King