我正在学习一些性能方面的东西... 这个问题可能听起来很愚蠢,但我会尝试回答。假设每个函数有100行相同的代码。这种差异是否真的很重要?在main
函数中执行哪一个会更快呢?
struct A
{
static void f()
{
cout << "static one";
}
};
或者这一个:
void f()
{
cout << "non static";
}
int main()
{
A::f();
f();
}