static method call vs. Singleton method call - performance

  • Thread starter Thread starter Victor Jones
  • Start date Start date
V

Victor Jones

I was involved recently in desiging a middle tier class where we essentially
need not track the state of the object, hence a class with static methods
was preferred. But there were some debate as to whether it made sense to
implement it as a singleton.

I wanted to know if there is any performance difference in CLR when calling
a static method vs. an call to instance method (where just a single instance
is used) - considering that there might be an initial expense in creating
the object on the heap.

Thanks
Victor
 
Because you'll only make it once, I don't think there's a huge difference in
performance.
I think you use a singleton when you need some state to be kept within the
object.

Greetz,
-- Rob.
 
Back
Top