G
Grahamo
Hi,
I have a a routine that is frequently called. It simply iterates over a
list of dates and does some sanity checking. The following pseudo code
summarises it.
void check()
{
const Date someDate = 1/1/2005;
for (each item)
{
process(item);
}
}
The above routine is called quite frequently.
My question relates to the construction of the Date object above. It's
constructor doesn't incur any great overhead however I'm curious to
know whether I should make it static. By doing that I'll obviously
call its constructor just once and will therefore save some time at
that point, but I'm wondering about the runtime overhead of using a
static? Is there a downside? This isn't a big issue at all, I'm just
curious to know whether it would be better declared as static or
constructed each time I invoke the routine.
Any opinions? Silly question.... there's *always* opinions on this
group
thanks and have a nice day
G
I have a a routine that is frequently called. It simply iterates over a
list of dates and does some sanity checking. The following pseudo code
summarises it.
void check()
{
const Date someDate = 1/1/2005;
for (each item)
{
process(item);
}
}
The above routine is called quite frequently.
My question relates to the construction of the Date object above. It's
constructor doesn't incur any great overhead however I'm curious to
know whether I should make it static. By doing that I'll obviously
call its constructor just once and will therefore save some time at
that point, but I'm wondering about the runtime overhead of using a
static? Is there a downside? This isn't a big issue at all, I'm just
curious to know whether it would be better declared as static or
constructed each time I invoke the routine.
Any opinions? Silly question.... there's *always* opinions on this
group
thanks and have a nice day
G