Thank you. Well, I am porting a desktop solution where having byte arrays with 100 thousand elements are not considered large (or uncommon). But now I know I should look out for these. As workaround I am currently using ArrayList (which, contrary to the desktop version, does not use System.arraycopy()), but will consider also your suggestion. Kind regards,
Csaba On Jan 3, 10:06 am, Thomas Broyer <[email protected]> wrote: > On Monday, January 2, 2012 12:05:33 PM UTC+1, cko wrote: > > > So the problem is invoking a varargs function (in our case > > Array.splice) with the content of the src array as individual function > > arguments. > > > Why is System.arraycopy() implemented like this? > > How would you have done it? Array.splice/Array.slice surely is the fastest > emulation of System.arraycopy. > > > Is this a known limitation? > > Not to my knowledge; probably no-one ever tried copying that many elements. > > > Are there recommended workarounds? > > Something like that maybe? > > while (length > MAX_ELEMENTS_PER_COPY) { > System.arraycopy(src, srcPos, dest, destPost, Math.max(length, > MAX_ELEMENTS_PER_COPY)); > srcPos += MAX_ELEMENTS_PER_COPY; > destPost += MAX_ELEMENTS_PER_COPY; > length -= MAX_ELEMENTS_PER_COPY; > > > > > > > > } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
