Path: utzoo!attcan!uunet!decwrl!public!eeh From: eeh@public.BTR.COM (Eduardo E. Horvath eeh@btr.com) Newsgroups: comp.sys.amiga Subject: Re: Objective C is a Kludge ( was Re: An Intuition.device? ) Message-ID: <398@public.BTR.COM> Date: 15 Sep 90 16:44:19 GMT References: <385@public.BTR.COM> <30261@nigel.ee.udel.edu> <389@public.BTR.COM> <30465@nigel.ee.udel.edu> Organization: BTR Public Access UNIX, MtnView CA, Contact: cs@btr.com 415-966-1429 Lines: 32 In article <30465@nigel.ee.udel.edu> new@ee.udel.edu (Darren New) writes: >In article <389@public.BTR.COM> I wrote: >>>The dynamic function calls should not be particularly slow either, >> Agreed, but Objective-C doesn't use function calls to invoke >>methods. It sends messages. >And the messages are looked up via a hash table and are turned into a call >on a function. Of course Objective-C uses function calls to invoke methods: >it compiles into C, and C only has functions. Just like C++ turns a message >(i.e., virtual function call) into a function call through an indirect pointer. >The only slow-down in Obj-C is running up the inheritance heirarchy, which >I understand has been optimized very well in the later versions. --Darren [ sig deleted ] But C++ only uses a call through an indirect pointer from a table if virtual functions are used. I have found that virtual functions and polymorphic objects are seldom used, and can usually be worked around. When virtual functions are not called through a pointer to an object, C++ uses either a standard C function call or no function call at all for inline functions. Now if you do this once or twice, there is very little difference noted in execution times. However if you are sending several thousand messages each second, say using a file requester with a hot scroll bar, a few microseconds per call begins to add up. I am a strong believer in the theory that any computations that can be done at compile time should be done at compile time rather than at run time. ========================================================================= Eduardo Horvath eeh@btr.com ..!{decwrl,mips,fernwood}!btr!eeh "Trust me, I know what I'm doing." - Sledge Hammer =========================================================================