This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: penalty for member functions?
- To: Ulrich dot Lauther at mchp dot siemens dot de
- Subject: Re: penalty for member functions?
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 23 Nov 1999 01:58:57 +0100
- CC: gcc at gcc dot gnu dot org
- References: <199911221004.LAA19969@fubini.mchp.siemens.de>
> I append the code below.
Very interesting. I find that there is a significant variation across
compiler versions. Leaving the optimization constant (-O2), I get
2.95.1:
flat loop 4.010
Foo::loop 3.740
2.95.2:
flat loop 4.010
Foo::loop 4.030
2.96 19991121 (experimental)
flat loop 4.300
Foo::loop 3.730
So, in no case I can observe that the method is slower than the
function. If anything, it is faster.
Comparing the assembler code in the 2.96 code, I find they are
*identical* with two exceptions:
- when the flat loop accesses a global variable (egdes), the method
goes through 'this'
- the entry and exit code is slightly different
I have not analysed this further.
Regards,
Martin
P.S. All of this was on
processor : 0
vendor_id : AuthenticAMD
cpu family : 5
model : 8
model name : AMD-K6(tm) 3D processor
stepping : 12
cpu MHz : 350.800525
with Linux 2.2.5, glibc 2.1