Consider the following code.
Is DoSomething1() faster then DoSomething2() in a 1000 consecutive executions? I would assume that if I where to call DoSomething1() it 1000 times it would be faster then calling DoSomething2() it 1000 times.
Is there any disadvantage to making all my large buffers static?
#define MAX_BUFFER_LENGTH 1024*5
void DoSomething1()
{
static char buf[MAX_BUFFER_LENGTH] ;
memset( buf, 0, MAX_BUFFER_LENGTH );
}
void DoSomething2()
{
char buf[MAX_BUFFER_LENGTH] ;
memset( buf, 0, MAX_BUFFER_LENGTH );
}
Thank you for your time.
Disadvantage of static buffers:
Advantages of static buffers:
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