From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA05780; Tue, 9 Dec 2003 14:17:42 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA02637 for ; Tue, 9 Dec 2003 14:17:39 +0100 (MET) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hB9DHdr26569 for ; Tue, 9 Dec 2003 14:17:39 +0100 (MET) Received: from akasha.ijm.jussieu.fr (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.10/jtpda-5.4) with ESMTP id hB9DHcqY003101 ; Tue, 9 Dec 2003 14:17:38 +0100 (CET) Received: by akasha.ijm.jussieu.fr (Postfix, from userid 11004) id AD68B3C978; Tue, 9 Dec 2003 14:17:32 +0100 (CET) From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16341.52076.429385.418402@akasha.ijm.jussieu.fr> Date: Tue, 9 Dec 2003 14:17:32 +0100 To: Nuutti Kotivuori Cc: caml-list@inria.fr Subject: Re: [Caml-list] Object-oriented access bottleneck In-Reply-To: <878ylmb3a8.fsf@naked.iki.fi> References: <871xrhe4hb.fsf@iki.fi> <20031207192702D.garrigue@kurims.kyoto-u.ac.jp> <87brqkcsxf.fsf@iki.fi> <20031208100725E.garrigue@kurims.kyoto-u.ac.jp> <87llpnbb4d.fsf@iki.fi> <20031208154244.GA20491@redhat.com> <006901c3bdeb$252ff510$0274a8c0@PWARP> <878ylmb3a8.fsf@naked.iki.fi> X-Mailer: VM 7.17 under Emacs 21.2.1 X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; andrieu:01 andrieu:01 caml-list:01 bottleneck:01 cannasse:01 inlined:01 slower:01 slower:01 generic:01 inlined:01 statically:01 foo:01 val:01 val:01 foo:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Nuutti Kotivuori [Tuesday 9 December 2003] : > > Nicolas Cannasse wrote: > > Obj.set_field (Obj.repr (Some 0)) 1000000 (Obj.repr ()) > > > > But I'm quite surprise that's it's not inlined and slower than > > setting a record field (according to the bench results)... and even > > slower than calling method (???) > > The implementation of Obj.set_field is: > > external set_field : t -> int -> t -> unit = "%obj_set_field" > > Where %obj_set_field is merely: > > Parraysetu Pgenarray; > > from the primitives_table, which is pretty generic. > > I am not sure why it isn't inlined either. It doesn't get inlined even > when having the declaration in the same source file. What are you talking about ? The Obj module and in particular Obj.set_field is about modifying caml values (records, variants, tuples, whatever), not caml objects. Access to instance variable in objects is not inlined because you can't statically known in which slot is the variable. Ex: class foo = object val x = 0 end class bar = object val y = 1 inherit foo end In an object foo, x is in slot 0, but in an object bar, x is in slot 1. (Actually that's not 0 and 1 but 2 and 3 because the object stores other stuff in the first two slots). -- Olivier ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners