Skip to content

Commit 7e746bf

Browse files
committed
more JIT
1 parent 51dc823 commit 7e746bf

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/main/java/org/apache/sysds/runtime/transform/encode/CompressedEncode.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,8 @@ private <T> AColGroup passThroughCompressed(final Array<T> a) throws Interrupted
480480
return ret;
481481
}
482482

483-
private <T> double[] passThroughCompressedCreateDict(final Array<T> a, Array<?> dict, final int dSize) throws InterruptedException, ExecutionException {
483+
private <T> double[] passThroughCompressedCreateDict(final Array<T> a, Array<?> dict, final int dSize)
484+
throws InterruptedException, ExecutionException {
484485
final double[] vals;
485486
final boolean nulls = a.containsNull();
486487
if(dict.getValueType() == ValueType.FP64 && !nulls) {
@@ -507,11 +508,12 @@ private double[] passThroughTransferNulls(Array<?> dict, final int dSize) {
507508
return vals;
508509
}
509510

510-
private void passThroughTransferNoNulls(Array<?> dict, final int dSize, DoubleArray converted) throws InterruptedException, ExecutionException {
511-
if(isParallel() && dSize > 10000){
512-
final int blkz = Math.min(10000 , (dSize + k) / k);
511+
private void passThroughTransferNoNulls(Array<?> dict, final int dSize, DoubleArray converted)
512+
throws InterruptedException, ExecutionException {
513+
if(isParallel() && dSize > 10000) {
514+
final int blkz = Math.min(10000, (dSize + k) / k);
513515
final List<Future<?>> tasks = new ArrayList<>();
514-
for(int i = 0; i < dSize ; i += blkz){
516+
for(int i = 0; i < dSize; i += blkz) {
515517
int si = i;
516518
int ei = Math.min(dSize, i + blkz);
517519
tasks.add(pool.submit(() -> {
@@ -746,14 +748,20 @@ private long parallelPutInto(List<ColGroupUncompressedArray> ucg, DenseBlock db,
746748
return nnz;
747749
}
748750

749-
private long putInto(List<ColGroupUncompressedArray> ucg, DenseBlock db, int il, int iu, int jl, int ju) {
751+
private final long putInto(List<ColGroupUncompressedArray> ucg, DenseBlock db, int il, int iu, int jl, int ju) {
750752
long nnz = 0;
751753
for(int i = il; i < iu; i++) {
752754
final double[] rval = db.values(i);
753755
final int off = db.pos(i);
754-
for(int j = jl; j < ju; j++) {
755-
nnz += (rval[off + j] = ucg.get(j).array.getAsNaNDouble(i)) == 0.0 ? 1 : 0;
756-
}
756+
nnz = putIntoRowBlock(ucg, jl, ju, nnz, i, rval, off);
757+
}
758+
return nnz;
759+
}
760+
761+
private final long putIntoRowBlock(List<ColGroupUncompressedArray> ucg, int jl, int ju, long nnz, int i,
762+
final double[] rval, final int off) {
763+
for(int j = jl; j < ju; j++) {
764+
nnz += (rval[off + j] = ucg.get(j).array.getAsNaNDouble(i)) == 0.0 ? 1 : 0;
757765
}
758766
return nnz;
759767
}

0 commit comments

Comments
 (0)