Re: Copy portions of array



The main byte array is a file being read in, which is discarded afterwards.
The feed to the smaller byte arrays is for processing the byte data in this
binary file. Yes, I need to copy it.

Evan


"Larry Serflaten" <serflaten@xxxxxxxxxxxxxx> wrote in message
news:%23fDwugSJHHA.3936@xxxxxxxxxxxxxxxxxxxxxxx

"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).


You already have the data in memory, why would you want to copy it?
About the only reason I can think of, that would require a copy, is that
you want to fork the data, and make changes to part of it, while keeping
the original intact.

If that is not your reason, do you really need to copy it? Could you
not just index it in different lists?

LFS




.



Relevant Pages

  • Re: About Thread Completion Notify.
    ... This is the reason that i must keep track of the threads and they have to ... i remove it from the array. ... > (which you probably don't since you are servicing requests in separate ... you shouldn't have a need for waiting on events. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: please confirm something (jdbc)
    ... of its internal buffer so that will double the amount of memory that you need. ... That's the reason I wrote my own dynamic byte array ... Given all the memory re-allocation that goes on inside the ByteArrayOutputStream anyway, I'm not sure that one more allocation is all that much extra overhead. ... If I have two ways of coding something, and I know that one will definitely use less memory (or be quicker for whatever reason) then I will choose the one "better" one. ...
    (comp.lang.java.programmer)
  • Re: Help needed on Arrays
    ... What does the SQL Stored Procedure do? ... Is there a specific reason you want to create an extra ... be in an array or arraylist. ... The language is vb.net 2005. ...
    (microsoft.public.vsnet.general)
  • Re: what is the best datatype for..
    ... array that will be scanned searching for the index value, ... It also won't be flexible if the input data changes for any reason, since the implementation itself is so dependent on the input data. ... Calling the dictionary solution "inefficient" is just plain dumb; it might not be quite as fast as a straight array lookup, but it's not like it's a _slow_ design. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: variables gets shared to child but resets back after exiting fork
    ... I have to run an external program but the program does not termination on some conditions, e.g, ping, will not exit unless you specify -c or some other circumstances. ... push @array, $_; ... If I don't use fork, I the way I would kill the process is by doing a call to pkill. ...
    (perl.beginners)