Click here to Skip to main content
15,912,069 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to customize a window Pin
MoustafaS18-Mar-05 12:26
MoustafaS18-Mar-05 12:26 
GeneralStatic Values Pin
MrEyes18-Mar-05 7:20
MrEyes18-Mar-05 7:20 
GeneralRe: Static Values Pin
Colin Angus Mackay18-Mar-05 7:27
Colin Angus Mackay18-Mar-05 7:27 
GeneralRe: Static Values Pin
Ravindra Sadaphule18-Mar-05 11:43
Ravindra Sadaphule18-Mar-05 11:43 
Generalmouse drag over problem Pin
ppp00118-Mar-05 5:11
ppp00118-Mar-05 5:11 
GeneralRe: mouse drag over problem Pin
Judah Gabriel Himango18-Mar-05 7:22
sponsorJudah Gabriel Himango18-Mar-05 7:22 
GeneralMemory optimisation Pin
PaleyX18-Mar-05 5:10
PaleyX18-Mar-05 5:10 
GeneralRe: Memory optimisation Pin
Andy Brummer18-Mar-05 5:46
sitebuilderAndy Brummer18-Mar-05 5:46 
Especially since this is C#, I would code whichever method is easiest for you and then only worry about it if there is an actual performance problem.

When you get to that point, creating one large buffer will typically go on the large object heap and requires more memory at one time, which might be faster on a single user system with few memory constraints.

Your second approach will use more memory during processing, however it will give the garbage collector a chance to collect already processed buffers.

A third approach is to use the stream directly, one pre-allocated buffer and read the data from the stream into the buffer without any allocations in your loop. This is more difficult especially if the records are not fixed size, but will typically perform the best of all the options since there is no allocation in the loop.

However, your loop needs to be driving an efficient processing operation for optimizing reading to make sense. If you are just creating an array of record objects in your loop for example, these changes won't make much of a difference.


I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

GeneralRe: Memory optimisation Pin
ACorbs19-Mar-05 11:40
ACorbs19-Mar-05 11:40 
GeneralGacUtil and RegAsm Pin
ppp00118-Mar-05 4:57
ppp00118-Mar-05 4:57 
GeneralRe: GacUtil and RegAsm Pin
Judah Gabriel Himango18-Mar-05 5:28
sponsorJudah Gabriel Himango18-Mar-05 5:28 
GeneralRe: GacUtil and RegAsm Pin
Mike Dimmick18-Mar-05 8:57
Mike Dimmick18-Mar-05 8:57 
GeneralMac address Pin
Member 178719018-Mar-05 3:54
Member 178719018-Mar-05 3:54 
GeneralRe: Mac address Pin
felopater18-Mar-05 15:13
felopater18-Mar-05 15:13 
GeneralRe: Mac address Pin
afinnell20-Mar-05 17:02
afinnell20-Mar-05 17:02 
GeneralPolicy not being applied to reference at this time Pin
Guillermo Jimenez18-Mar-05 3:47
Guillermo Jimenez18-Mar-05 3:47 
GeneralRe: Policy not being applied to reference at this time Pin
Member 9878981-Jul-10 12:26
Member 9878981-Jul-10 12:26 
Generaldraw on transparent control over a mediaplayer Pin
spAAwn18-Mar-05 2:57
spAAwn18-Mar-05 2:57 
GeneralRe: draw on transparent control over a mediaplayer Pin
MoustafaS18-Mar-05 12:35
MoustafaS18-Mar-05 12:35 
GeneralRe: draw on transparent control over a mediaplayer Pin
spAAwn18-Mar-05 12:44
spAAwn18-Mar-05 12:44 
GeneralRe: draw on transparent control over a mediaplayer Pin
MoustafaS18-Mar-05 14:13
MoustafaS18-Mar-05 14:13 
GeneralRe: draw on transparent control over a mediaplayer Pin
spAAwn18-Mar-05 14:28
spAAwn18-Mar-05 14:28 
GeneralRe: draw on transparent control over a mediaplayer Pin
MoustafaS19-Mar-05 6:48
MoustafaS19-Mar-05 6:48 
GeneralRe: draw on transparent control over a mediaplayer Pin
Dave Kreskowiak18-Mar-05 16:33
mveDave Kreskowiak18-Mar-05 16:33 
GeneralRe: draw on transparent control over a mediaplayer Pin
ACorbs19-Mar-05 11:20
ACorbs19-Mar-05 11:20 

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.