c# - Performance vs clean code? -
msdn's performance tuning recommendations this:
make chunky calls chunky call function call performs several tasks, such method initializes several fields of object. viewed against chatty calls, simple tasks , require multiple calls things done (such setting every field of object different call). it's important make chunky, rather chatty calls across methods overhead higher simple, intra-appdomain method calls. p/invoke, interop , remoting calls carry overhead, , want use them sparingly. in each of these cases, should try design application doesn't rely on small, frequent calls carry overhead.
but how comply solid design principles? trying tune performance on brownfield windows forms application, , have been refactoring more solid. degrading performance this?
i think important part is:
where overhead higher simple, intra-appdomain method calls
so if you're calling web service, make 1 call returns data in 1 go rather making multiple calls. if you're calling database, maybe stored procedure return multiple recordsets rather making lots of calls. code inside web service or sp can solid, etc.
Comments
Post a Comment