I am developing a java program in which I'm using a big array of instances of a Class. I have to make some calculations for every object of the array (using its Class methods). When I order the array using Arrays.Sort or other methods I notice an increment of the calculation time to perform my computations, that is excluding the time to do the sort!
If I comment the Arrays.sort function, prior to the other computation the time of calculation is about 1 or 2 milliseconds, while uncommenting it increases to 5 or 6 ms.
I have to do this work for huge number of steps (even 300,000) so the increment changes a lot my performances.
Is there any explanation for this strange behaviour?