Quite an academic question this – I’ve had it remarked that a class I’ve written in a WCF service is very long (~3000 lines) and it should be broken down into smaller classes.
The scope of the service has grown over time and the methods contained contain many similar functions hence me not creating multiple smaller classes up until now so I’ve no problem with doing so (other than the time it’ll take to do so!), but it got me thinking – is there a significant performance overhead in using a single large class instead of multiple smaller classes? If so, why?
It won’t make any noticeable difference. Before even thinking about such extreme micro-optimization, you should think about maintainability, which is quite endangered with a class of about 3000 LOC.
Write your code first such that it is correct and maintainable. Only if you then really run into performance problems, you should first profile your application before making any decisions about optimizations. Usually performance bottlenecks will be found somewhere else (lack of parallelization, bad algorithms etc.).