public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0
@ 2010-04-25 7:18 yuri at tsoft dot com
2010-04-26 18:55 ` [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation hjl dot tools at gmail dot com
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: yuri at tsoft dot com @ 2010-04-25 7:18 UTC (permalink / raw)
To: gcc-bugs
I ran this simple example with the argument 45 through various versions of gcc
(option -O3):
#include <stdlib.h>
#include <stdio.h>
int fib(int AnArg) {
if (AnArg <= 2) return (1);
return (fib(AnArg-1)+fib(AnArg-2));
}
int main(int argc, char* argv[]) {
int n = atoi(argv[1]);
printf("fib(%i)=%i\n", n, fib(n));
}
Here are the average runtimes I got:
version time
4.3.1 3.930s
4.3.2 3.500s
4.3.3 3.470s
4.4.1 3.930s
4.4.3 3.940s
4.5.0 3.860s
I ran ~10 samples so values are approximate, but it's quite obvious that 4.5.0
has very significant degradation compared to 4.3.3.
Is there a performance suite for gcc that is ran for each release, are results
available online?
This case is pretty simple, basic. I would expect gcc to produce quite optimal
code for it.
--
Summary: Performance degradation of the simple example
(fibonacci) 4.3.3->4.5.0
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yuri at tsoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
@ 2010-04-26 18:55 ` hjl dot tools at gmail dot com
2010-04-29 1:21 ` hjl dot tools at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-04-26 18:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from hjl dot tools at gmail dot com 2010-04-26 18:54 -------
It is caused by revision 131576:
http://gcc.gnu.org/ml/gcc-cvs/2008-01/msg00337.html
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.4/4.5/4.6 Regression] |[4.4/4.5/4.6 Regression]
|Performance degradation for |Performance degradation for
|simple fibonacci numbers |simple fibonacci numbers
|calculation due to extra |calculation
|stack alignment |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
2010-04-26 18:55 ` [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation hjl dot tools at gmail dot com
@ 2010-04-29 1:21 ` hjl dot tools at gmail dot com
2010-04-29 2:20 ` hjl dot tools at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-04-29 1:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from hjl dot tools at gmail dot com 2010-04-29 01:20 -------
Revision 139756:
http://gcc.gnu.org/ml/gcc-cvs/2008-08/msg01321.html
also contributed to this regression.
[hjl@gnu-26 rrs]$ ./131573/usr/bin/gcc -O3 pr43884.c
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.237s
user 0m3.236s
sys 0m0.000s
[hjl@gnu-26 rrs]$ ./131573/usr/bin/gcc -O3 pr43884.c -m32
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.667s
user 0m3.665s
sys 0m0.001s
[hjl@gnu-26 rrs]$ ./131576/usr/bin/gcc -O3 pr43884.c
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.687s
user 0m3.685s
sys 0m0.000s
[hjl@gnu-26 rrs]$ ./131576/usr/bin/gcc -O3 pr43884.c -m32
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.685s
user 0m3.683s
sys 0m0.001s
[hjl@gnu-26 rrs]$
[hjl@gnu-26 rrs]$ ./139755/usr/bin/gcc -O3 pr43884.c
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.261s
user 0m3.260s
sys 0m0.002s
[hjl@gnu-26 rrs]$ ./139755/usr/bin/gcc -O3 pr43884.c -m32
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.043s
user 0m3.041s
sys 0m0.001s
[hjl@gnu-26 rrs]$ ./139756/usr/bin/gcc -O3 pr43884.c
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.909s
user 0m3.906s
sys 0m0.001s
[hjl@gnu-26 rrs]$ ./139756/usr/bin/gcc -O3 pr43884.c -m32
[hjl@gnu-26 rrs]$ time ./a.out 45
fib(45)=1134903170
real 0m3.883s
user 0m3.881s
sys 0m0.000s
[hjl@gnu-26 rrs]$
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
2010-04-26 18:55 ` [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation hjl dot tools at gmail dot com
2010-04-29 1:21 ` hjl dot tools at gmail dot com
@ 2010-04-29 2:20 ` hjl dot tools at gmail dot com
2010-04-29 9:27 ` hubicka at ucw dot cz
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-04-29 2:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from hjl dot tools at gmail dot com 2010-04-29 02:20 -------
This patch:
diff --git a/gcc/predict.c b/gcc/predict.c
index eb5ddef..a05e796 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -120,7 +120,8 @@ maybe_hot_frequency_p (int freq)
if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
return true;
}
- if (profile_status == PROFILE_ABSENT)
+ if (profile_status == PROFILE_ABSENT
+ || profile_status == PROFILE_GUESSED)
return true;
if (freq < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
return false;
seems to work for me. Since profile_status is PROFILE_GUESSED,
it may be hot as shown here.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
` (2 preceding siblings ...)
2010-04-29 2:20 ` hjl dot tools at gmail dot com
@ 2010-04-29 9:27 ` hubicka at ucw dot cz
2010-04-30 9:01 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: hubicka at ucw dot cz @ 2010-04-29 9:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from hubicka at ucw dot cz 2010-04-29 09:27 -------
Subject: Re: [4.4/4.5/4.6 Regression] Performance
degradation for simple fibonacci numbers calculation
This is not correct, when profile is guessed we should look into the
frequencies.
I guess profile is wrong after tail recursion elimination or horked by
recursive inlining,
I will take a look.
Honza
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
` (3 preceding siblings ...)
2010-04-29 9:27 ` hubicka at ucw dot cz
@ 2010-04-30 9:01 ` jakub at gcc dot gnu dot org
2010-05-19 12:37 ` rguenth at gcc dot gnu dot org
2010-06-25 14:10 ` hjl dot tools at gmail dot com
6 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-30 9:01 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.4.4 |4.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
` (4 preceding siblings ...)
2010-04-30 9:01 ` jakub at gcc dot gnu dot org
@ 2010-05-19 12:37 ` rguenth at gcc dot gnu dot org
2010-06-25 14:10 ` hjl dot tools at gmail dot com
6 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-19 12:37 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Version|unknown |4.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
` (5 preceding siblings ...)
2010-05-19 12:37 ` rguenth at gcc dot gnu dot org
@ 2010-06-25 14:10 ` hjl dot tools at gmail dot com
6 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-25 14:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from hjl dot tools at gmail dot com 2010-06-25 14:09 -------
(In reply to comment #17)
> Subject: Re: [4.4/4.5/4.6 Regression] Performance
> degradation for simple fibonacci numbers calculation
>
> This is not correct, when profile is guessed we should look into the
> frequencies.
> I guess profile is wrong after tail recursion elimination or horked by
> recursive inlining,
> I will take a look.
>
Any updates?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43884
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-01-22 21:54 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-43884-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 12:08 ` [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation jakub at gcc dot gnu.org
2011-01-22 17:31 ` hubicka at gcc dot gnu.org
2011-01-22 21:51 ` hubicka at gcc dot gnu.org
2011-01-22 21:59 ` hubicka at gcc dot gnu.org
2011-01-22 22:10 ` hubicka at gcc dot gnu.org
2010-04-25 7:18 [Bug c++/43884] New: Performance degradation of the simple example (fibonacci) 4.3.3->4.5.0 yuri at tsoft dot com
2010-04-26 18:55 ` [Bug target/43884] [4.4/4.5/4.6 Regression] Performance degradation for simple fibonacci numbers calculation hjl dot tools at gmail dot com
2010-04-29 1:21 ` hjl dot tools at gmail dot com
2010-04-29 2:20 ` hjl dot tools at gmail dot com
2010-04-29 9:27 ` hubicka at ucw dot cz
2010-04-30 9:01 ` jakub at gcc dot gnu dot org
2010-05-19 12:37 ` rguenth at gcc dot gnu dot org
2010-06-25 14:10 ` hjl dot tools at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).