Click here to Skip to main content
15,894,291 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Coding styles Pin
Member 44870832-Nov-10 8:51
Member 44870832-Nov-10 8:51 
GeneralRe: Coding styles Pin
Pete O'Hanlon2-Nov-10 12:06
mvePete O'Hanlon2-Nov-10 12:06 
AnswerRe: Coding styles Pin
PIEBALDconsult29-Oct-10 16:34
mvePIEBALDconsult29-Oct-10 16:34 
GeneralRe: Coding styles Pin
Member 448708329-Oct-10 23:12
Member 448708329-Oct-10 23:12 
GeneralRe: Coding styles Pin
PIEBALDconsult31-Oct-10 4:27
mvePIEBALDconsult31-Oct-10 4:27 
GeneralRe: Coding styles Pin
Member 44870832-Nov-10 7:39
Member 44870832-Nov-10 7:39 
GeneralRe: Coding styles Pin
PIEBALDconsult2-Nov-10 18:22
mvePIEBALDconsult2-Nov-10 18:22 
GeneralRe: Coding styles Pin
Member 44870833-Nov-10 7:35
Member 44870833-Nov-10 7:35 
PIEBALDconsult wrote:
Like what?


I've read a really good blog about this, but I can't find it now. I'm going by memory.

The first potential (but very minor) benefit happens because of the way the JIT compiler works. If you have the following code
if (x) A(); else B();
then only one of the methods (A or B) with be compiled the first time that it is executed.

With smaller methods there is also a greater chance that CPU registers will be used rather than normal memory.

In addition to this there is the inlining which I have already mentioned. So, in some cases smaller methods can out perform larger methods, and most of the time it's probably hard to tell which will perform best. I always code in a way that is easy to read/maintain because that is what we spend most of our time doing and the performance difference is not worth worrying about 99% of the time.

In addition to this it's also worth remembering how slow other things are. If your code does database queries or uses files then the additional time to call another method really isn't going to make a difference.
AnswerRe: Coding styles Pin
Abhinav S29-Oct-10 19:13
Abhinav S29-Oct-10 19:13 
AnswerRe: Coding styles [modified] Pin
Jeff Connelly17-Nov-10 3:42
Jeff Connelly17-Nov-10 3:42 
QuestionSeeking a binary read/write file stream class Pin
PIEBALDconsult28-Oct-10 15:45
mvePIEBALDconsult28-Oct-10 15:45 
AnswerRe: Seeking a binary read/write file stream class Pin
Luc Pattyn28-Oct-10 15:57
sitebuilderLuc Pattyn28-Oct-10 15:57 
GeneralRe: Seeking a binary read/write file stream class Pin
PIEBALDconsult28-Oct-10 16:57
mvePIEBALDconsult28-Oct-10 16:57 
GeneralRe: Seeking a binary read/write file stream class Pin
Luc Pattyn28-Oct-10 17:14
sitebuilderLuc Pattyn28-Oct-10 17:14 
GeneralRe: Seeking a binary read/write file stream class [modified] Pin
PIEBALDconsult28-Oct-10 17:21
mvePIEBALDconsult28-Oct-10 17:21 
AnswerRe: Seeking a binary read/write file stream class Pin
_Erik_29-Oct-10 3:10
_Erik_29-Oct-10 3:10 
GeneralRe: Seeking a binary read/write file stream class Pin
PIEBALDconsult29-Oct-10 3:27
mvePIEBALDconsult29-Oct-10 3:27 
AnswerRe: Seeking a binary read/write file stream class Pin
Andy Brummer3-Nov-10 18:19
sitebuilderAndy Brummer3-Nov-10 18:19 
GeneralRe: Seeking a binary read/write file stream class [modified] Pin
PIEBALDconsult7-Nov-10 4:44
mvePIEBALDconsult7-Nov-10 4:44 
Questionhelp needed Pin
rksreadero28-Oct-10 8:52
rksreadero28-Oct-10 8:52 
AnswerRe: help needed PinPopular
Luc Pattyn28-Oct-10 9:07
sitebuilderLuc Pattyn28-Oct-10 9:07 
AnswerRe: help needed Pin
kadaoui el mehdi28-Oct-10 11:19
kadaoui el mehdi28-Oct-10 11:19 
GeneralRe: help needed Pin
Pete O'Hanlon28-Oct-10 11:34
mvePete O'Hanlon28-Oct-10 11:34 
GeneralRe: help needed Pin
kadaoui el mehdi28-Oct-10 11:39
kadaoui el mehdi28-Oct-10 11:39 
GeneralRe: help needed Pin
Pete O'Hanlon28-Oct-10 11:47
mvePete O'Hanlon28-Oct-10 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.