In .NET would there be issues to consider between a static method in a static class and an instance method in a regular class with respect to scalability?
Is there going to be a “log jam” if many many calls are made to a static method in a class? Or is that not an issue. If so, would it be better to use an instance method?
Something like a method like GetCustomers() that is called to retrieve customer data.
EDIT:
The question is not as much about performance of a call to each type of method which has been addressed in other questions/answers, but about scalability. If you have 10K calls per second to a static vs an instance method is the static method going to have problems? Or does it not matter.
lt really doesn’t matter. What matters is whether or not the method needs access to the state of a specific instance of the class. If not, you can make it static, if not you can’t. If you are asking strictly on a theoretical basis, then assuming the method doese NOT need access to instance state data, then obviously there is a minor advantedge to a static method as you don’t have to create a useless object on the heap in order to use it… If you made it an instance method you would have to create an instance (only ONE instance, since it does not need any state data, which instance, or what the state of the instance is doesn’t matter) – Only ONE instance no matter how many times you need to call it…
but one instance on a typical sized class is not an onerous hit… assuming this class (type) doesn’t take 3 GigaBytes of heap space !