title: Weird running times when splitting array with copyOfRange
body: <p>I got a comma separated file with 10 977 120 random numbers (60 MBs), of which I have get the sum of. The task is about doing this concurrently, and thus in the fasted way possible. Long story short, I load the text file into a string array. My next idea was to then separate this array into four smaller pieces, and then for each piece, have a thread that sums the piece.</p>
  
  <p>Weirdly I'm getting very different running times, when I split the list into 4 pieces.</p>
  
  <p>I've got a method that looks like this:</p>
  
  <pre><code>public void splitNumbers(String[] numbers){
      int size = numbers.length;
      String[][] numberssplit = new String[4][];
      numberssplit[0] = Arrays.copyOfRange(numbers, 0, size/4);
      numberssplit[1] = Arrays.copyOfRange(numbers, (size/4)+1, size/2);
      numberssplit[2] = Arrays.copyOfRange(numbers, (size/2)+1, 3*(size/4));
      numberssplit[3] = Arrays.copyOfRange(numbers, (3*(size/4))+1, size-1);
      //MS: 2750
  }
  </code></pre>
  
  <p>Above takes about 2750 ms</p>
  
  <pre><code>numberssplit[0] = Arrays.copyOfRange(numbers, 0, size/4);
  numberssplit[1] = Arrays.copyOfRange(numbers, (size/4)+1, size/2);
  //numberssplit[2] = Arrays.copyOfRange(numbers, (size/2)+1, 3*(size/4));
  //numberssplit[3] = Arrays.copyOfRange(numbers, (3*(size/4))+1, size-1);
  MS: 5
  </code></pre>
  
  <p>however, only splitting two parts, takes 5 MS, making it look like it's the last two pieces that's taking longer.</p>
  
  <p>Only splitting the third part takes 2 ms</p>
  
  <pre><code>//numberssplit[0] = Arrays.copyOfRange(numbers, 0, size/4);
  //numberssplit[1] = Arrays.copyOfRange(numbers, (size/4)+1, size/2);
  numberssplit[2] = Arrays.copyOfRange(numbers, (size/2)+1, 3*(size/4));
  //numberssplit[3] = Arrays.copyOfRange(numbers, (3*(size/4))+1, size-1);
  //MS: 2
  </code></pre>
  
  <p>And so does the fourth part when it's the only piece being split.</p>
  
  <pre><code>//numberssplit[0] = Arrays.copyOfRange(numbers, 0, size/4);
  //numberssplit[1] = Arrays.copyOfRange(numbers, (size/4)+1, size/2);
  //numberssplit[2] = Arrays.copyOfRange(numbers, (size/2)+1, 3*(size/4));
  numberssplit[3] = Arrays.copyOfRange(numbers, (3*(size/4))+1, size-1);
  //MS: 2
  </code></pre>
  
  <p>At last, the last two uncommented, takes 2927 ms</p>
  
  <pre><code>//numberssplit[0] = Arrays.copyOfRange(numbers, 0, size/4);
  //numberssplit[1] = Arrays.copyOfRange(numbers, (size/4)+1, size/2);
  numberssplit[2] = Arrays.copyOfRange(numbers, (size/2)+1, 3*(size/4));
  numberssplit[3] = Arrays.copyOfRange(numbers, (3*(size/4))+1, size-1);
  //MS: 2927
  </code></pre>
  
  <p>It seems like when <code>numbersplit[2]</code> and <code>numbersplit[3]</code> is combined it takes a lot longer, but why is that? Obviously java, is doing some magic behind the scenes, but I'm unable to see the logic. So whats happening?</p>