Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 68ab904

Browse files
hkielOpenModelica-Hudson
authored andcommitted
use Array.heapSort to reduce memory usage for large models
Belonging to [master]: - #2048
1 parent aa30cda commit 68ab904

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5002,6 +5002,7 @@ protected
50025002
DAE.ComponentRef cref;
50035003
Integer size, i, j;
50045004
list<Integer> intLst;
5005+
array<Integer> intArr;
50055006
list<DAE.ComponentRef> crefs;
50065007
algorithm
50075008
//create HT
@@ -5028,7 +5029,9 @@ algorithm
50285029
j := BaseHashTable.get(cr, ht);
50295030
intLst := j :: intLst;
50305031
end for;
5031-
intLst := List.sort(intLst, intGt);
5032+
intArr := listArray(intLst);
5033+
Array.heapSort(intArr);
5034+
intLst := arrayList(intArr);
50325035
outSparse := (i, intLst) :: outSparse;
50335036
end for;
50345037
outSparse := List.sort(outSparse, Util.compareTupleIntGt);
@@ -5045,6 +5048,7 @@ protected
50455048
DAE.ComponentRef cref;
50465049
Integer size, i, j;
50475050
list<Integer> intLst;
5051+
array<Integer> intArr;
50485052
list<DAE.ComponentRef> crefs;
50495053
algorithm
50505054
//create HT
@@ -5071,7 +5075,9 @@ algorithm
50715075
j := BaseHashTable.get(cr, ht);
50725076
intLst := j :: intLst;
50735077
end for;
5074-
intLst := List.sort(intLst, intGt);
5078+
intArr := listArray(intLst);
5079+
Array.heapSort(intArr);
5080+
intLst := arrayList(intArr);
50755081
outSparse := (i, intLst) :: outSparse;
50765082
i := i + 1;
50775083
end for;

0 commit comments

Comments
 (0)