Re: Copy portions of array

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Do you really need to copy the data or could you work on it in place
if you just had a pointer to the section of the array you need to work
on?

Bryan
_________________________________________________________
Bryan Stafford "Don't need no more lies"
New Vision Software - Neil Young -
www.mvps.org/vbvision Living With War : The Restless Consumer
alpineDon'tSpam@xxxxxxxx


On Thu, 21 Dec 2006 12:32:48 -0600, "wxforecaster"
<wxforecaster@xxxxxxxxx> wrote:

What rest of the story? (There isn't much to add).

I have situation involving a very large byte array (potentially some
10-20MB) in size. I need to routinely copy small portions of this array
(some 300-400 bytes in size) to another byte array (of that dimention) for
processing.

It sounds like CopyMemory is the most efficient means of tackling this, but
if there are alternatives, I'm willing to here them. I'm going for speed
here. Right now the current procedure involves a for loop, setting each
array element individually.

Evan



"alpine" <alpine_don'tsendspam@xxxxxxxx> wrote in message
news:8ljlo2h9745oecrrpvn6nsumjf49utvpmj@xxxxxxxxxx
OK, what about the rest of the story? The more information you
provide, the more specific an answer can be. With what you've
provided so far, there is still a wide range of possibilities.

Bryan
_________________________________________________________
Bryan Stafford "Don't need no more lies"
New Vision Software - Neil Young -
www.mvps.org/vbvision Living With War : The Restless Consumer
alpineDon'tSpam@xxxxxxxx


On Thu, 21 Dec 2006 11:23:12 -0600, "wxforecaster"
<wxforecaster@xxxxxxxxx> wrote:

Specifically all the data in all the arrays are of the byte data type.

Evan


"alpine" <alpine_don'tsendspam@xxxxxxxx> wrote in message
news:1vflo2553u8j6p068ca0grcu10564f942v@xxxxxxxxxx
On Thu, 21 Dec 2006 10:48:27 -0600, "wxforecaster"
<wxforecaster@xxxxxxxxx> wrote:

Say I have an array with 5000 elements in it
arr(4999)

I want to copy a portion of that array (say elements 100 to 400) to a
new
array:
arr2(300)

Is there a more efficient and quicker way to perform this action vs. a
for
loop???

For i = 100 to 400
arr2(i-100) = arr(i)
Next i

I'm dealing with some very large data sizes here (this was just an
arbitrary
example).

A lot depends on what your data looks like. If you have variable
length strings in your data, it would also depend on whether you
actually want to *copy* the data or *move* it.

If you provide more info, it will help you get a more complete answer.

HTH,
Bryan
_________________________________________________________
Bryan Stafford "Don't need no more lies"
New Vision Software - Neil Young -
www.mvps.org/vbvision Living With War : The Restless Consumer
alpineDon'tSpam@xxxxxxxx




.



Relevant Pages

  • Re: Kernel Development & Objective-C
    ... Now people which about having pointers outside the array, which is a crock in practice, as long as you don't actually /use/ an out of range value. ... I did an optimizer on the Pcode which caught jumps to jumps, then had separate 8080 and L66 code generators into GMAP on the GE and the CP/M assembler or the Intel assembler for 8080. ... There was also an 8085 code generator using the "ten undocumented instructions" from the Dr Dobbs article. ... "Woe unto the statesman who makes war without a reason that will still ...
    (Linux-Kernel)
  • Re: Remove whitespace elements of an array.
    ... > foreach loop, delete the elements that are empty, and store ... > doesn't do anything to the array. ... "I know not with what weapons World War 3 will be fought, but World War 4 will be fought with sticks and stones." ...
    (comp.lang.perl.misc)
  • Re: Copy portions of array
    ... I have situation involving a very large byte array (potentially some ... www.mvps.org/vbvision Living With War: The Restless Consumer ...
    (microsoft.public.vb.general.discussion)
  • Re: Remove first letter of each string in array
    ... > This does indeed remove the first letter of each string in this array, ... Use Perl's 'for' or 'foreach'; ... "War is too serious a matter to entrust to military men." ...
    (comp.lang.perl.misc)
  • Re: trouble with session variable
    ... Forms in an HTML document are in an array. ... "Chuck" wrote in message ... >>solve puzzles for a living ... >>> <%Dim selectedValue ...
    (microsoft.public.frontpage.programming)