public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/18943] New: exponential (?) compile-time behavior with many arithmetic if statements
@ 2004-12-12 17:10 Thomas dot Koenig at online dot de
  2004-12-13  8:57 ` [Bug fortran/18943] more than quadratic " Thomas dot Koenig at online dot de
  2004-12-14 22:09 ` tobi at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas dot Koenig at online dot de @ 2004-12-12 17:10 UTC (permalink / raw)
  To: gcc-bugs

Another case of bad compilation time.  Memory consumption
is also very heavy.

I believe this is different from PR 18937 and PR 18938, because

- a g77 based on gcc 3.3 does not have this problem

$ cat spaghetti-if
#! /usr/bin/perl

$last = shift;

for ($i=2; $i<=$last; $i++) {
    push(@lines, sprintf("%5d i=i+1\n      if (i-%d) %d, %d, %d\n", $i, $i,
$i-1, $i, $i+1));
}
for ($i=0; $i<=$last; $i++) {
    $j = int(rand($last));
    $temp = $lines[$i];
    $lines[$i] = $lines[$j];
    $lines[$j] = $temp;
}
print "      i=0\n";
print " 1    goto 2\n";
print @lines;
printf "%5d continue\n",$last+1;
print  "      print *,i\n";
print  "      end\n";
$ perl spaghetti-if 1000 > spaghetti-if.f
$ time gfortran spaghetti-if.f

real    0m3.687s
user    0m3.620s
sys     0m0.030s
$                                  
$ perl spaghetti-if 3000 > spaghetti-if.f
$ time gfortran spaghetti-if.f

real    0m41.834s
user    0m39.119s
sys     0m0.144s
$ ./spaghetti-if 5000 > spaghetti-if.f
$ time gfortran spaghetti-if.f

real    2m7.288s
user    2m6.634s
sys     0m0.213s
$ ./a.out
        5001
$ time g77 spaghetti-if.f

real    0m10.930s
user    0m10.316s
sys     0m0.104s
$ perl spaghetti-if 4
      i=0
 1    goto 2
    4 i=i+1
      if (i-4) 3, 4, 5
    2 i=i+1
      if (i-2) 1, 2, 3
    3 i=i+1
      if (i-3) 2, 3, 4
    5 continue
      print *,i
      end

-- 
           Summary: exponential (?) compile-time behavior with many
                    arithmetic if statements
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18943


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/18943] more than quadratic compile-time behavior with many arithmetic if statements
  2004-12-12 17:10 [Bug fortran/18943] New: exponential (?) compile-time behavior with many arithmetic if statements Thomas dot Koenig at online dot de
@ 2004-12-13  8:57 ` Thomas dot Koenig at online dot de
  2004-12-14 22:09 ` tobi at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas dot Koenig at online dot de @ 2004-12-13  8:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Thomas dot Koenig at online dot de  2004-12-13 08:57 -------
It's not exponential, the exponent is somewhere between
2.2 and 2.3.

Here's a number of test cases on an Itanium 2 with 1.3 GHz:

$last    time(s)
10000	476.4
7000	212.8
5000	101.2
3000	29.8

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|exponential (?) compile-time|more than quadratic compile-
                   |behavior with many          |time behavior with many
                   |arithmetic if statements    |arithmetic if statements


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18943


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/18943] more than quadratic compile-time behavior with many arithmetic if statements
  2004-12-12 17:10 [Bug fortran/18943] New: exponential (?) compile-time behavior with many arithmetic if statements Thomas dot Koenig at online dot de
  2004-12-13  8:57 ` [Bug fortran/18943] more than quadratic " Thomas dot Koenig at online dot de
@ 2004-12-14 22:09 ` tobi at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-12-14 22:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-12-14 22:09 -------
The quadraticness is in the handling of labels, so this is the same as PR18937

*** This bug has been marked as a duplicate of 18937 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18943


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-14 22:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-12 17:10 [Bug fortran/18943] New: exponential (?) compile-time behavior with many arithmetic if statements Thomas dot Koenig at online dot de
2004-12-13  8:57 ` [Bug fortran/18943] more than quadratic " Thomas dot Koenig at online dot de
2004-12-14 22:09 ` tobi at gcc dot gnu dot org

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).