public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Confusing optimization
@ 2010-05-09 19:25 Luca Béla Palkovics
  2010-05-10  4:49 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Luca Béla Palkovics @ 2010-05-09 19:25 UTC (permalink / raw)
  To: gcc-help

void a()
{
	... do my stuff
}

void b()
{
	... do my stuff
}

int main(int argc, char *argv[])
{
	a();
	b();	
}

>g++ main.cpp -O3
>./a.out
a takes 125ms
b takes 340ms

now the same but seperated
int main(int argc, char *argv[])
{
	a();
}

>g++ main.cpp -O3
>./a.out
a takes 85ms

Is this normal ? b has nothing todo with a .. why does a get slower ?
(b is also faster without a...)

Luca.

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

end of thread, other threads:[~2010-05-12 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-09 19:25 Confusing optimization Luca Béla Palkovics
2010-05-10  4:49 ` Ian Lance Taylor
2010-05-10 14:27   ` Luca Béla Palkovics
2010-05-10 16:41     ` Ian Lance Taylor
2010-05-12 14:24       ` Luca Béla Palkovics

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