This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 3.2.1 optimizer degradation (strlen, -O2)


> 11-Jan-2003 17:52 Eli Zaretskii wrote:
>>> From: "Leonid Pauzner" <uue@pauzner.dnttm.ru>
>>> Date: Sat, 11 Jan 2003 15:49:13 +0300 (MSK)
>>>
>>> It turns out that the libc strlen() function (compiled with -O2)
>>> became nearly 2 times slower when I switched from gcc 2.95.3 to gcc 3.2.1
>>> on a Pentium machine.

>> Are you sure you get the library strlen?  IIRC, GCC provides its own
>> inline versions of some functions, and I think strlen is one of them.

>> Examining the code (use the -S switch to GCC to produce it) should
>> show you whether my guess was true.

[I was wrong in my previous post, lost -O2]
You are right.
2.95 do inline strlen(), while 3.2.1 is not.
Nevertheless I got the following results in my test:

gcc321 -O2
strlen.c   20 sec
strlen2.c  17 sec
(library?) 14 sec

gcc295 -O2
strlen.c   16 sec  (main.c was compiled without -O)
strlen2.c  11 sec  (main.c was compiled without -O)
(builtin)   8 sec

So the difference exists but not that dramatic.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]