public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marco Morandini <morandini@aero.polimi.it>
To: gcc@gcc.gnu.org
Subject: A user question (was: Re: Faster compilation speed)
Date: Tue, 13 Aug 2002 10:34:00 -0000	[thread overview]
Message-ID: <3D5943EB.5080208@aero.polimi.it> (raw)

I'm a simple user, so
please forgive me if
I'm asking something obvious.

With Version 1 of the code below the compile time at -O2
is approx a quadratic function of the number of call to pippo(a);
With Version 2 of the code the compile time is approx a linear
function of N.
Is this reasonable? On a 650MHz PIII with 512 Mb of memory
I get the following timings for Version 1:

N     seconds
1000  1.1
10000 16
20000 49
30000 92
40000 186

After that, with 50000 lines of code,
g++ eats all the memory, and goes to swap.

gcc -v
Reading specs from 
/home2/marco/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../configure --enable-threads 
--enable-languages=c,c++,f77 --prefix=/home2/marco/local
Thread model: posix
gcc version 3.1

Thanks, and apologize again if this is only noise.

Marco


Version 1
-------------------
class A{
private:
	double c;
public:
	virtual ~A();
};
void dummy(const A&a);
int main(void) {
	A a;
	pippo(a);
           .
           .
    //repeat this line N times
           .
           .
        pippo(a);
        return 0;
}

-------------------

Version 2
-------------------
void dummy(const double&a);
int main(void) {
	double a;
	pippo(a);
           .
           .
    //repeat this line N times
           .
           .
        pippo(a);
        return 0;
}

-------------------


             reply	other threads:[~2002-08-13 10:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-13 10:34 Marco Morandini [this message]
2002-08-13 10:47 ` Marco Morandini
2002-08-13 14:29 ` Mike Stump
2002-08-13 17:06   ` PATCH: " Mike Stump
2002-08-13 19:53     ` Richard Henderson
2002-08-14  4:10     ` Michael Matz
2002-08-14  4:42       ` Michael Matz

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=3D5943EB.5080208@aero.polimi.it \
    --to=morandini@aero.polimi.it \
    --cc=gcc@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).