Answer the question
In order to leave comments, you need to log in
Why is the standard filling of an int array several times slower than using an Object[] array?
Now I'm studying compilers and then I started to arrange simple experiments and found that a seemingly more complicated way works many times faster?
Why is this code, with declaring an array, 1-10 times faster, and the fill rate is
O(α(n)) while the most standard way is O(a(n)*log(n)) which is much more?
//За 40-60 мс
List s=new ArrayList(a);
int i=0;
for(Object p : s){
p=i++;
}
int i2[]=new int[a];
for(i=0;i<a;i++){
i2[i]=i;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question