Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!pacbell.com!pacbell!att!cbnewsc!lgm From: lgm@cbnewsc.att.com (lawrence.g.mayka) Newsgroups: comp.object Subject: Re: What is Objective C? Summary: Beware of hasty generalizations Message-ID: <1990Sep5.013922.6739@cbnewsc.att.com> Date: 5 Sep 90 01:39:22 GMT References: <3864@bingvaxu.cc.binghamton.edu> <2700002@hpspkla.spk.hp.com> <1990Sep4.034131.532@cbnewsl.att.com> Organization: AT&T Bell Laboratories Lines: 41 In article <1990Sep4.034131.532@cbnewsl.att.com>, psrc@cbnewsl.att.com (Paul S. R. Chisholm) writes: > So . . . will a program that, by the language definition, must do > garbage collection, run as quickly as a program where the "user" (the > programmer in the language in question) must manage memory? Probably > not, unless the language implementor has done a terrific job, and the > "user" has botched it. Will a program that, by the language > definition, must do an additional memory indirection, or even a table > look up at run time, run as quickly as a program where subroutine calls > can be translated straightforwardly into a subroutine call instruction? > Same answer. 1) Typical user-written memory management schemes, ranging from 'malloc' and 'free' to reference counting, are considerably *less* efficient than a well-written garbage collection algorithm. Further performance improvement in this matter typically comes only with some kind of "staticization" - e.g., fixed-size per-type buffer pools. 2) Language definitions rarely specify particular implementation techniques such as memory indirections or table lookups. Rather, a language might require the implementation to behave in a particular situation *as if* an array reference or table lookup takes place. Implementors are typically free to optimize the common cases (e.g., via caching or even instruction modification) at the expense of slowing down more exotic operations (e.g., the ones not reasonably available in a less powerful language anyway). 3) Attempting to deduce the performance of entire programs - written in different languages and styles - from the execution speed of individual machine instructions is a dubious endeavor at best. One of the advantages of a more powerful programming language is to facilitate the implementation of algorithms which are highly efficient but practically infeasible to implement in a less powerful language. In other words: At high levels of complexity, micromanagement may *lose* to macromanagement. Lawrence G. Mayka AT&T Bell Laboratories lgm@iexist.att.com Standard disclaimer.