Re: Eiffel and Efficiency Issues

jimp@cognos.uucp (Jim Patterson)
Wed, 20 Jun 90 04:16:32 GMT

          From comp.compilers

Related articles
Eiffel and Efficiency Issues (1990-06-07)
Re: Eiffel and Efficiency Issues burtonl@cognos.uucp (1990-06-14)
Re: Eiffel and Efficiency Issues jimp@cognos.uucp (1990-06-20)
Re: Eiffel and Efficiency Issues (1990-07-07)
| List of all articles for this month |

Newsgroups: comp.compilers,comp.lang.eiffel
From: jimp@cognos.uucp (Jim Patterson)
Followup-To: comp.compilers
References: <graham.644716278@bizet>
Date: Wed, 20 Jun 90 04:16:32 GMT
Organization: Cognos Inc., Ottawa, Canada

In article <graham.644716278@bizet> (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 a bit of time working with version 2.1c of the Eiffel compiler
(arouind 1988). The generated code appeared to spend a good deal of
time doing table lookups in order to implement multiple inheritence.
This affects both attribute and routine access. A routine call
requires that a function pointer be extracted from a two-dimensional
table, where one of the indices requires another array index
operation. Its general form (in C) is:

                (*Routines[DType(t1)][DDxxx[DType(t1)]+N])(t1,other args);

where Routines is the (two-dimensional) routines table, t1 is an
object, DType is a macro which extracts a field from the header of the
object t1, DDxxx is a table of integers (xxx identifies the type), and
N is a literal (the routine index). This is roughly equivalent to
a function call in C (though of course C doesn't support multiple or
even simple inheritence).

Examples of these operations are readily available in the generated C
code from the Eiffel compiler. There's a similar operation for
extracting an attribute of an object.


(Here, DATPTR is a basic "Pointer to DATUM", t1 an object, Dxxx is
another table of integers (with xxx identifying the type), and N a
literal (the attribute number). This is the rough equivalent of
a structure field reference in C (though again C doesn't have support
for inheritence).

Eiffel also spends quite a bit of time in routine prologue and
epilogue code, which has to set up information for the exception
handler and garbage collector. The 2.1c version did runtime setup of
the various tables that were needed for multiple inheritence support
as well. In a large system (say 300+ classes), these took enormous
amounts of time during startup.

Frankly, the 20-25% figure seems pretty low to me. It's not really
so much that the code is of poor quality (though there is some slop),
but that the computational model is at a higher level and quite a bit
more complex than C.
Jim Patterson Cognos Incorporated
UUCP:decvax!utzoo!dciem!nrcaer!cognos!jimp P.O. BOX 9707
PHONE:(613)738-1440 3755 Riverside Drive
                                                                                      Ottawa, Ont K1G 3Z4


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.