Sorting optimizations: do not make excessive copies, introduce methods to sort the whole array.

#KT-9904 Fixed
This commit is contained in:
Ilya Gorbunov
2015-11-05 19:12:32 +03:00
parent 3e81cdfc5d
commit 8bdd1e3246
7 changed files with 199 additions and 65 deletions
+7 -9
View File
@@ -999,17 +999,15 @@
mutableList.sort(boundComparator);
}
//TODO: should be deleted when List will be JS Array-like (https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Working_with_Array-like_objects)
var array = [];
var it = mutableList.iterator();
while (it.hasNext()) {
array.push(it.next());
}
if (mutableList.size > 1) {
//TODO: should be deleted when List will be JS Array-like (https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Working_with_Array-like_objects)
var array = Kotlin.copyToArray(mutableList);
array.sort(boundComparator);
array.sort(boundComparator);
for (var i = 0, n = array.length; i < n; i++) {
mutableList.set_vux3hl$(i, array[i]);
for (var i = 0, n = array.length; i < n; i++) {
mutableList.set_vux3hl$(i, array[i]);
}
}
};