Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!arizona.edu!arizona!dave From: dave@cs.arizona.edu (Dave P. Schaumann) Newsgroups: comp.sys.amiga.misc Subject: Re: Object Oriented Programming Message-ID: <749@caslon.cs.arizona.edu> Date: 29 Jan 91 00:56:25 GMT References: <42954@nigel.ee.udel.edu> Organization: U of Arizona CS Dept, Tucson Lines: 34 In article <42954@nigel.ee.udel.edu> NJ_GOKEM%FANDM.BITNET@pucc.princeton.edu writes: |Hi out there, | |I am taking a seminar in Object Oriented Programming, and now the class |seems to believe that OOP is slower than Procedure-programming. |An article in Byte in 86 argues that it could be 50 % slower. | |I want to help this belief out of the world! | Does anyone have any comments? |Or is C++, and Smalltalk slower than regular C ??? Yes, it is true. Object oriented programming languages are generally slower than more traditional languages. Additionally, many OOPL (like Smalltalk) are traditionally interpreted (slowing them down more). |The basic argument is that the computer would spend too much time trying to |find the right "METHOD" in the tree of inherited "METHODS", since OBJECTS |inherit a lot of "METHODS". Is this TRUE? The designers of C++ took the course of getting OO functionality with the minimum amound of cost at execution time. They got it down to the cost of an extra indirection for every function call. Eg., a call like bar->foo() in C++ translates to something like (*bar->foo)() in actuality. (modulo the hidden 'self' parameter, of course). The moral of the story is There Aint No Such Thing As A Free Lunch. (say, that sounds familiar...) |Nils Gokemeijer |(NJ_GOKEMEIJE@FANDM.bitnet) Dave Schaumann | And then -- what then? Then, future... dave@cs.arizona.edu | -Weather Report