Confusing optimization
Luca Béla Palkovics
luca.bela.palkovics@gmail.com
Sun May 9 19:25:00 GMT 2010
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.
More information about the Gcc-help
mailing list