Skip to content

Commit

Permalink
use Array.heapSort to reduce memory usage for large models
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2048
  • Loading branch information
hkiel authored and OpenModelica-Hudson committed Nov 24, 2017
1 parent aa30cda commit 68ab904
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -5002,6 +5002,7 @@ protected
DAE.ComponentRef cref;
Integer size, i, j;
list<Integer> intLst;
array<Integer> intArr;
list<DAE.ComponentRef> crefs;
algorithm
//create HT
Expand All @@ -5028,7 +5029,9 @@ algorithm
j := BaseHashTable.get(cr, ht);
intLst := j :: intLst;
end for;
intLst := List.sort(intLst, intGt);
intArr := listArray(intLst);
Array.heapSort(intArr);
intLst := arrayList(intArr);
outSparse := (i, intLst) :: outSparse;
end for;
outSparse := List.sort(outSparse, Util.compareTupleIntGt);
Expand All @@ -5045,6 +5048,7 @@ protected
DAE.ComponentRef cref;
Integer size, i, j;
list<Integer> intLst;
array<Integer> intArr;
list<DAE.ComponentRef> crefs;
algorithm
//create HT
Expand All @@ -5071,7 +5075,9 @@ algorithm
j := BaseHashTable.get(cr, ht);
intLst := j :: intLst;
end for;
intLst := List.sort(intLst, intGt);
intArr := listArray(intLst);
Array.heapSort(intArr);
intLst := arrayList(intArr);
outSparse := (i, intLst) :: outSparse;
i := i + 1;
end for;
Expand Down

0 comments on commit 68ab904

Please sign in to comment.