I’m aware that a common performance refactoring is to replace simple for‘s by System.arraycopy.
I want to ask about:
-
When exactly does system.arraycopy begin to make sense (considering it’s a native method call). Does copying small things say, < 32 have any advantage?
-
Is it my impression, or is it not simply possible to copy (efficiently) a cycle like this with arraycopy:
for (int j = 0; j < 2; ++j) { vpr[m][s + j][i] = vr[j]; }
System.arrayCopyis likely the fastest way to copy an array, but it does not make deep copies.It also cannot do the more complex example in your second question.