Re: [ADVANCED-DOTNET] trim byte array

2006-07-10 Thread dave wanta
just an update. Thanks again for all the great suggestions. I created a wrapper class that used an ArrayList of byte[]'s. I totally removed the MemoryStream from the method. The memory footprint decreased by over 1/2, and speed increased 3x. There were alot of other changes that were made, so th

Re: [ADVANCED-DOTNET] trim byte array

2006-07-07 Thread dave wanta
Thanks for the suggestion. Unfortunately, this app is done in 1.x. Cheers! Dave - Original Message - From: "Sebastien Lorion" <[EMAIL PROTECTED]> To: Sent: Friday, July 07, 2006 8:47 AM Subject: Re: [ADVANCED-DOTNET] trim byte array Have you looked at PowerCollec

Re: [ADVANCED-DOTNET] trim byte array

2006-07-07 Thread Sébastien Lorion
This clause prevents use with GPL type of license but as far as I know, there is no problem with LGPL or MIT for example. Sébastien On 7/7/06, Barry Kelly <[EMAIL PROTECTED]> wrote: Sebastien Lorion <[EMAIL PROTECTED]> wrote: > Have you looked at PowerCollections ? A caution about PowerCollec

Re: [ADVANCED-DOTNET] trim byte array

2006-07-07 Thread Barry Kelly
Sebastien Lorion <[EMAIL PROTECTED]> wrote: > Have you looked at PowerCollections ? A caution about PowerCollections: it has a bizarre license. In particular, this term here: ---8<--- In return, we simply require that you agree: [...] B. That you are not allowed to combine or distribute the

Re: [ADVANCED-DOTNET] trim byte array

2006-07-07 Thread Sebastien Lorion
y footprint. Once again, thanks all for your feedback. Cheers! Dave - Original Message - From: "Stoyan Damov" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 4:13 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > Dave, > > Are you willing to share with us

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread J. Merrill
moving >to a dynamically expanding byte array, but the Trimming part is what I >was/am worried about. > >Cheers! >Dave > > > >----- Original Message - >From: "David Lanouette" <[EMAIL PROTECTED]> >To: >Sent: Thursday, July 06, 2006 3:37 PM &g

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread gregory young
t the bytes in the array. Erick > -Original Message- > From: Discussion of advanced .NET topics. > [mailto:ADVANCED-DOTNET@DISCUSS.DEVELOP.COM ] On Behalf Of Stoyan Damov > Sent: Thursday, July 06, 2006 5:12 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re:

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Erick Thompson
- > From: Discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of dave wanta > Sent: Thursday, July 06, 2006 5:09 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] trim byte array > > hmmm.. I think you may have mis-under

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Erick Thompson
nt: Thursday, July 06, 2006 5:12 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] trim byte array > > Gregory was talking about the implementation details of > List<> which copies the existing items when it grows. On a > side note, List<*by

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
looking at adding byte arrays to the ArrayList, not individual bytes. Cheers! Dave - Original Message - From: "gregory young" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 4:49 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > An arraylist containi

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
ng to decrease the memory footprint. Once again, thanks all for your feedback. Cheers! Dave - Original Message - From: "Stoyan Damov" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 4:13 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > Dave, > > Are y

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Stoyan Damov
al Message- > From: Discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of > gregory young > Sent: Thursday, July 06, 2006 2:50 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] trim byte array > > An arraylist containing by

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Erick Thompson
his. Erick > -Original Message- > From: Discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of > gregory young > Sent: Thursday, July 06, 2006 2:50 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] trim byte array &g

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread gregory young
rk? Simply as a quick prototype? Cheers! Dave - Original Message - From: "Erick Thompson" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 3:26 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > It's the copy that gets pricey, which is going to be hard to avoid in

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Robert Rolls
@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] trim byte array dave wanta <[EMAIL PROTECTED]> wrote: > That would be a good work-around. But, I don't have write access (gotta love > all of these constraints. ;-) ) The solution I would use in this scenario is a class I've developed

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Stoyan Damov
Dave, Are you willing to share with us the interface(s) of your component. If we see how your component's clients will use it, we might be able to come up with an idea. Cheers, Stoyan On 7/6/06, dave wanta <[EMAIL PROTECTED]> wrote: I wish I could. But basically these are large blobs (usually

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Peter van der Weerd
t; <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 7:51 PM Subject: [ADVANCED-DOTNET] trim byte array | hi all, | does anyone know of an efficient way to trim a byte array? | | Here is what is happening. I'm reading in some binary data into a | dynamically expanding byte array,

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Stoyan Damov
Saad was suggesting that you either build an unmanaged DLL or a managed C++ wrapper, pass chunks of data to it and get the result when finished. This however has the following drawbacks, which you might want to consider before moving to implementation: - you'll essentially copy all data three tim

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
, 2006 3:37 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > Dave, > > Do you really need to keep all the data around? Could you read a few meg, > then process that data, then read more data and process that, etc... ? > > I've found it rare to "have to" deal with

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
er if even something quick and dirty of an ArrayList of byte arrays would work? Simply as a quick prototype? Cheers! Dave - Original Message - From: "Erick Thompson" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 3:26 PM Subject: Re: [ADVANCED-DOTNET] trim byte ar

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Barry Kelly
dave wanta <[EMAIL PROTECTED]> wrote: > That would be a good work-around. But, I don't have write access (gotta love > all of these constraints. ;-) ) The solution I would use in this scenario is a class I've developed for a similar purpose. As you may be aware, large objects (i.e. greater than 8

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread David Lanouette
lto:[EMAIL PROTECTED] On Behalf Of dave wanta > Sent: Thursday, July 06, 2006 4:26 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] trim byte array > > That would be a good work-around. But, I don't have write > access (gotta love all of these

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
That would be a good work-around. But, I don't have write access (gotta love all of these constraints. ;-) ) Cheers! Dave - Original Message - From: "Barry Kelly" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 3:20 PM Subject: Re: [ADVANCED-DOTNET] trim by

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Erick Thompson
essage- > 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 wou

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Barry Kelly
dave wanta <[EMAIL PROTECTED]> wrote: > It's from a socket, so I don't know the size until i get the terminating > characters. You could probably consider streaming it to a temporary file, then, since I expect a download of many 100s of MB wouldn't be immediate. You wouldn't want many of those ar

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread gregory young
Dave this is how list 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 exce

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
ROTECTED]> To: Sent: Wednesday, July 05, 2006 7:00 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > I don't think you can resize managed arrays. > > If its super important, you can keep the byte array in unmanaged space and call a realloc (or equivalent) on it. > > -s &g

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
Hi Chris, I was using a list of primes to dynamically grow the byte array, and keep track of the length of read data. Cheers! Dave - Original Message - From: "Chris Anderson" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 1:21 PM Subject: Re: [ADVANCED-DOTNET]

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
Hi Stoyan, It's from a socket, so I don't know the size until i get the terminating characters. Cheers! Dave - Original Message - From: "Stoyan Damov" <[EMAIL PROTECTED]> To: Sent: Thursday, July 06, 2006 2:43 PM Subject: Re: [ADVANCED-DOTNET] trim byte arra

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
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.

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
AIL PROTECTED]> To: Sent: Thursday, July 06, 2006 1:06 PM Subject: Re: [ADVANCED-DOTNET] trim byte array > Use a MemoryStream. > > Adam.. > > > -Original Message- > > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > > [EMAIL PROTECTED] On Beh

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Stoyan Damov
Hi Dave, Are you reading your data from a fixed storage (e.g. a file, and not from a socket) and do you know how much bytes you'd need upfront? If you do then you can preallocate the buffer w/ the exact size you need, but I guess you don't know the size upfront. If you don't, then I'd suggest wha

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread David Lanouette
[mailto:[EMAIL PROTECTED] On Behalf Of Saad Rehmani > Sent: Wednesday, July 05, 2006 8:00 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] trim byte array > > I don't think you can resize managed arrays. > > If its super important, you can k

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Saad Rehmani
D]> Date: Thu, 6 Jul 2006 12:51:24 To:ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [ADVANCED-DOTNET] trim byte array hi all, does anyone know of an efficient way to trim a byte array? Here is what is happening. I'm reading in some binary data into a dynamically expanding byte array, until

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread gregory young
that buffer into your large array. > > Also, out of interest, how are you dynamically expanding your array? > > > -Original Message- > From: "dave wanta"<[EMAIL PROTECTED]> > Sent: 06/07/06 19:01:06 > To: "ADVANCED-DOTNET@DISCUSS.DEVELOP.COM&qu

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread gregory young
06/07/06 19:01:06 To: "ADVANCED-DOTNET@DISCUSS.DEVELOP.COM"< ADVANCED-DOTNET@DISCUSS.DEVELOP.COM> Subject: [ADVANCED-DOTNET] trim byte array hi all, does anyone know of an efficient way to trim a byte array? Here is what is happening. I'm reading in some binary data into a dy

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Adam Sills
Use a MemoryStream. Adam.. > -Original Message- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of dave wanta > Sent: Thursday, July 06, 2006 12:51 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: [ADVANCED-DOTNET] trim

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Adam Tuliper
DOTNET] trim byte array hi all, does anyone know of an efficient way to trim a byte array? Here is what is happening. I'm reading in some binary data into a dynamically expanding byte array, until all of the data has been read into memory. I need to trim the byte array to remove the trailing nul

Re: [ADVANCED-DOTNET] trim byte array

2006-07-06 Thread Chris Anderson
al Message- From: "dave wanta"<[EMAIL PROTECTED]> Sent: 06/07/06 19:01:06 To: "ADVANCED-DOTNET@DISCUSS.DEVELOP.COM" Subject: [ADVANCED-DOTNET] trim byte array hi all, does anyone know of an efficient way to trim a byte array? Here is what is happening. I'm readi

[ADVANCED-DOTNET] trim byte array

2006-07-06 Thread dave wanta
hi all, does anyone know of an efficient way to trim a byte array? Here is what is happening. I'm reading in some binary data into a dynamically expanding byte array, until all of the data has been read into memory. I need to trim the byte array to remove the trailing nulls. Because the amount of