It's the copy that gets pricey, which is going to be hard to avoid in this 
situation. A list just won't cut it with this size. I would suggest a new class 
that uses a list of byte[], and then uses the length of the internal byte array 
to determine the right array to touch in the indexer. I have to head out of the 
office, but I could throw together some code later if you need me to. It makes 
random access slower, but then you don't need to ever copy the data until the 
final step when you spit out the array, which should speed it up a lot. 

Erick



> -----Original Message-----
> From: Discussion of advanced .NET topics. 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> gregory young
> Sent: Thursday, July 06, 2006 1:00 PM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] trim byte array
> 
> Dave this is how list<byte> would work as well ... you can 
> however set an initial size if you know it to avoid these doublings.
> 
> Cheers,
> 
> Greg
> 
> 
> On 7/6/06, dave wanta <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > btw, just fyi...if you Reflector a MemoryStream, it doubles it's 
> > internal buffer every time it exceeds it's length.
> >
> > The MemoryStream is really clean from a programmatic 
> standpoint, it's 
> > just not the performance I really want.
> >
> > Thanks for all the suggestions guys!  I really appreciate it.
> >
> > Cheers!
> > Dave
> >
> > ===================================
> > This list is hosted by DevelopMentor   http://www.develop.com
> >
> > View archives and manage your subscription(s) at 
> > http://discuss.develop.com
> >
> 
> 
> 
> --
> If knowledge can create problems, it is not through ignorance 
> that we can solve them.
> 
> Isaac Asimov
> 

Reply via email to