I'm trying to studdy some performace things...
this question may sound stupid, but I'll give it a try.
Let's assume each function has 100 lines of same code.
or does this difference dosn't realy metter?
which one will be faster on execution in main
function:
struct A
{
static void f()
{
cout << "static one";
}
};
or this one:
void f()
{
cout << "non static";
}
int main()
{
A::f();
f();
}
There's no difference, the compiler works out the address at compile time and dispatches execution to it in one step at run-time (if it doesn't inline it, which it's equally able/likely to do with either).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With