public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: hzoli@hzoli.2y.net
To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Cc: rth@gcc.gnu.org
Subject: c++/10760: Compile time increases quadratically with struct size
Date: Mon, 12 May 2003 22:46:00 -0000	[thread overview]
Message-ID: <E19FLzH-0005mr-00@hzoli.austin.ibm.com> (raw)
In-Reply-To: <E19FLRF-0005HF-00@hzoli.austin.ibm.com>


>Number:         10760
>Category:       c++
>Synopsis:       Compile time increases quadratically with struct size
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 12 22:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Zoltan Hidvegi
>Release:        gcc version 3.3 20030512 (prerelease)
>Organization:
>Environment:
System: x86/Linux & PowerPC/AIX

>Description:
Name lookups for struct members use linear search, which can result in
quadratic compile time increase.  See also c/10675:
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10675
http://gcc.gnu.org/ml/gcc-bugs/2003-05/msg01072.html

This happens in both c and c++, but I can only specify one category.

>How-To-Repeat:
The following is a shell script that will generate a struct with a
given number of members and a functions that assings zero to all
members.

------- BEGIN biggen.sh -------------
#! /bin/sh
let i=0
echo 'struct foo {'
while [ "$i" -lt "$1" ]
do
    echo "    int i_$((i=i+1));"
done
echo '};'
#echo 'struct foo f;'

let i=0
echo 'void init_foo(struct foo *p) {'
while [ "$i" -lt "$1" ]
do
    echo "    p->i_$((i=i+1)) = 0;"
done
echo '}'
--------- END biggen.sh -------------

Run it like this:
./biggen.sh 10000 > big.C; time g++ -c big.c
Change the number from 10000 and see how the compile time is
affected.  Also watch the memory usage, e.g. with 25000 members it
needs 55M, but the memory usage scales linearly.

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


      parent reply	other threads:[~2003-05-12 22:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-12  3:32 c/10675: " rth
     [not found] ` <E19FLRF-0005HF-00@hzoli.austin.ibm.com>
2003-05-12 22:46   ` hzoli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E19FLzH-0005mr-00@hzoli.austin.ibm.com \
    --to=hzoli@hzoli.2y.net \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=rth@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).