Path: utzoo!attcan!uunet!mcsun!ukc!pyrltd!tetrauk!rick From: rick@tetrauk.UUCP (Rick Jones) Newsgroups: comp.lang.eiffel Subject: Re: Eiffel and Efficiency Issues Message-ID: <489@tetrauk.UUCP> Date: 8 Jun 90 10:21:09 GMT References: Reply-To: rick@tetrauk.UUCP (Rick Jones) Organization: Tetra Ltd., Maidenhead, UK Lines: 42 In article graham@maths.su.oz.au (Graham Matthews) writes: >In the Eiffel reference manual there are claims that Eiffel code (ie: C code >generated by Eiffel) executes 20-25% (I think these figures are right?) >slower than native C code. > >Can anyone tell me why this is? Is it just poor quality C code produced from >the front end that is the cause of the problem? > I spent some time profiling the performance of Eiffel 2.2 a few months ago. I didn't compare Eiffel with C directly, but I found the overheads of memory management - allocation and garbage collection - far higher than ISE suggested. In fairness, their figure of 20-25% against C is only claimed to be true if you have _no_ assertion checking, no garbage collection, and compile the C-package version of your program. Most of this overhead is due to the look-ups involved in making feature calls (have you ever looked at the generated C code? - it can give C compilers a hard time!). ISE say they are working on improving the efficiency of the generated code - I'm looking forward to seeing 2.3. In my test programs with garbage collection, where I was in fact creating and dropping objects quite liberally, I found that the various memory management functions (the C routines in _run_time.a) were taking about 70% of the total process time. I dived into this code in some detail, and it seemed that a large part of the overhead was concerned with the extra problems of looking for and dealing with expanded and bitfield objects. Since these were only introduced in 2.2, I presume 2.1 (which I never used) was in fact a lot more efficient. In order to see how much it could be improved, I took a lot of C library code apart and rearanged it, and got it down to about 30% of the process time, as well as fixing some definite bugs which can cause certain programs to crash when garbage collection is is use. ISE have copies of all these changes, so I'm expecting 2.3 to be a big improvement. In the end though, Eiffel is a high-level language and is unlikely ever to give the same absolute efficiency as a low-level language like C. This trade-off is as old as computers, and I think that in Eiffel's case what you get in language capability is pretty good compared to what you loose in efficiency. -- Rick Jones You gotta stand for something Tetra Ltd. Maidenhead, Berks Or you'll fall for anything rick@tetrauk.uucp (...!ukc!tetrauk.uucp!rick) - John Cougar Mellencamp