gcc: speed problem with several g++ versions

Andreas Kowarz kowarz@math.tu-dresden.de
Wed Aug 4 14:32:00 GMT 2004


Hi,

thank you for the quick response and your suggestions.

According to platform dependent results:
We have testes the old example on a Pentium3 700 MHz and on an Athlon-XP 1666 
MHz. The problem with the template version occurred for both machines.

However, we have a new example which leads to much more interesting results on 
these machines by using gcc332 and gcc341, respectively. The new example 
contains some overloaded basic operators, which can be used for very simple 
derivative calculations. The interesting observations concern the runtime, again.
On the Pentium3 the function evaluation (prog) needs more than twice the time 
than calculating function AND derivative (progover). (Somebody should wake me up 
:-) ). The difference on the Athlon-XP is not that high but has the same 
(unbelievable) signature.

By the way: We will not optimize our code for a specific compiler and version 
since we do not know, which compiler our users will apply. But we seem to have a 
good point for discussion about speed, now.

I hope this information is useful for gcc development.

Sincerely yours,

Andreas Kowarz

================================================================================

Falk Hueffner wrote:
> Andreas Kowarz <kowarz@math.tu-dresden.de> writes:
> 
> 
>>we made some interesting experience while implementing and testing a
>>software package, which makes use of overloaded operators. One aspect
>>of the implementation is the speed of the resulting binaries. To find
>>the best solution we have tested the following approaches: normal
>>overloading and templates. The example (attachment) contains the
>>source code for 3 programms:
>>
>>prog     - execution without overloading
>>progtemp - template based
>>progover - normal overloading
>>
>>Compiled with g++ version 3.2 we got the following runtime:
>>prog       about 2.9 seconds
>>progtemp   about 2.9 seconds
>>progover   about 3.5 seconds
>>It seems clear that the template based implementation should be the one to use.
>>
>>After recompiling with g++ version 3.4.1 we got a complete different result:
>>prog       about 2.9 seconds
>>progtemp   about 15.4 seconds !!!
>>progover   about 3.5 seconds
>>This time the template version is not really good. :-(
>>(Same problem with g++ version 3.3.2 on a different machine)
>>
>>My questions are:
>>- Is this a known problem?
>>- Is there a compiler switch which can solve the problem?
> 
> 
> This seems to be something target specific; on Alpha, I get the exact
> same time for all three programs with both 3.3 and 3.4. I guess one
> would have to look at the assembly to see what causes it... might be
> register allocation or inlining. You could try changing inline
> settings and -fomit-frame-pointer and -fnew-ra.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: template_example_3.tar.bz2
Type: application/x-bzip
Size: 2375 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20040804/742412b6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kowarz.vcf
Type: text/x-vcard
Size: 339 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20040804/742412b6/attachment.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20040804/742412b6/attachment.sig>


More information about the Gcc-help mailing list