public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A user question (was: Re: Faster compilation speed)
@ 2002-08-13 10:34 Marco Morandini
  2002-08-13 10:47 ` Marco Morandini
  2002-08-13 14:29 ` Mike Stump
  0 siblings, 2 replies; 7+ messages in thread
From: Marco Morandini @ 2002-08-13 10:34 UTC (permalink / raw)
  To: gcc

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;
}

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


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

* Re: A user question (was: Re: Faster compilation speed)
  2002-08-13 10:34 A user question (was: Re: Faster compilation speed) Marco Morandini
@ 2002-08-13 10:47 ` Marco Morandini
  2002-08-13 14:29 ` Mike Stump
  1 sibling, 0 replies; 7+ messages in thread
From: Marco Morandini @ 2002-08-13 10:47 UTC (permalink / raw)
  To: gcc

Marco Morandini wrote:
> wrong code....

bleah!
Here is the right code
(pippo (dummy in italian) <-> dummy)


Marco


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

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

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

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




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

* Re: A user question (was: Re: Faster compilation speed)
  2002-08-13 10:34 A user question (was: Re: Faster compilation speed) Marco Morandini
  2002-08-13 10:47 ` Marco Morandini
@ 2002-08-13 14:29 ` Mike Stump
  2002-08-13 17:06   ` PATCH: " Mike Stump
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Stump @ 2002-08-13 14:29 UTC (permalink / raw)
  To: Marco Morandini; +Cc: gcc

On Tuesday, August 13, 2002, at 10:37 AM, Marco Morandini wrote:

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

* PATCH: Re: A user question (was: Re: Faster compilation speed)
  2002-08-13 14:29 ` Mike Stump
@ 2002-08-13 17:06   ` Mike Stump
  2002-08-13 19:53     ` Richard Henderson
  2002-08-14  4:10     ` Michael Matz
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Stump @ 2002-08-13 17:06 UTC (permalink / raw)
  To: Mike Stump; +Cc: Marco Morandini, gcc, gcc-patches

On Tuesday, August 13, 2002, at 02:29 PM, Mike Stump wrote:

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

* Re: PATCH: Re: A user question (was: Re: Faster compilation speed)
  2002-08-13 17:06   ` PATCH: " Mike Stump
@ 2002-08-13 19:53     ` Richard Henderson
  2002-08-14  4:10     ` Michael Matz
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2002-08-13 19:53 UTC (permalink / raw)
  To: Mike Stump; +Cc: Marco Morandini, gcc, gcc-patches

On Tue, Aug 13, 2002 at 05:06:42PM -0700, Mike Stump wrote:
>       * sched-rgn.c (CHECK_DEAD_NOTES): Limit how much checking
>	we do to avoid n^2 behavior.

I don't like it.

Instead, arrange to make a single pass across the rtl removing
and counting death notes and storing the counts into an array
indexed by basic block.  The add up the counts for each block
in the region as is sort of done currently.



r~

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

* Re: PATCH: Re: A user question (was: Re: Faster compilation speed)
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Matz @ 2002-08-14  4:10 UTC (permalink / raw)
  To: Mike Stump; +Cc: Marco Morandini, gcc, gcc-patches

Hi,

On Tue, 13 Aug 2002, Mike Stump wrote:

> :-(  The biggest single culprit count wise is some aggressive checking
> code.  The below change save 1.5 minutes of compile time out of 5
> minutes on an n=20,000 case.  The top of the tree is much worse than a
> gcc 3.1 compiler, 5 minutes compared to 56 seconds.

This is a typical case why I strongly dislike such arbitrary cutoff means
to avoid slow behaviour instead of redesigning how it works.  From the
code you posted it seems, that the blocks bitmap is extremely sparse (in
the second loop only one bit is set in evry case, the second loop only
seems to set one bit each time by pure luck), but still it's completely
traversed, through pointer chasing even (the bb double linked list).
This suggests to change the interface of count_or_remove_death_notes() to
take a bitmap (not sbitmap), and rearrange the outer loop of it, to use
EXECUTE_IF_SET_IN_BITMAP().


Ciao,
Michael.

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

* Re: PATCH: Re: A user question (was: Re: Faster compilation speed)
  2002-08-14  4:10     ` Michael Matz
@ 2002-08-14  4:42       ` Michael Matz
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Matz @ 2002-08-14  4:42 UTC (permalink / raw)
  To: Mike Stump; +Cc: Marco Morandini, gcc, gcc-patches

On Wed, 14 Aug 2002, Michael Matz wrote:

> code you posted it seems, that the blocks bitmap is extremely sparse (in
> the second loop only one bit is set in evry case, the second loop only
                                                        ^^^^^^
                                                        first of course

> seems to set one bit each time by pure luck), but still it's completely


Ciao,
Michael.

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

end of thread, other threads:[~2002-08-14  4:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-13 10:34 A user question (was: Re: Faster compilation speed) Marco Morandini
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

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