#80 NativeArray: fix moveTo, moveFrom if other array has different type

닫힘
ranides4 년 전을 오픈 · 2개의 코멘트
ranides 코멘트됨, 4 년 전

At this moment moveTo/moveFrom assumes that second array has identical type. If second array has different, even assign-compatible type, exception will be thrown because we will try to convert at array level.

It should be implemented in this way, that current implementation runs for identical types, and unoptimized version (which uses get/set) is returned in other cases.

At this moment moveTo/moveFrom assumes that second array has *identical* type. If second array has different, even assign-compatible type, exception will be thrown because we will try to convert at array level. It should be implemented in this way, that current implementation runs for identical types, and unoptimized version (which uses get/set) is returned in other cases.
ranides 코멘트됨, 4 년 전
소유자

The same applies to all comparators

The same applies to all comparators
ranides 코멘트됨, 4 년 전
소유자

comparators use cast at object level:

public IntComparator comparator(NativeArray values) {
    DoubleArray that = (DoubleArray)values;
    return (a,b) -> Double.compare(this.array[a], that.array[b]);
}

it can be transformed to:

public IntComparator comparator(NativeArray values) {
    double[] other = values.$array();
    return (a,b) -> Double.compare(this.array[a], other[b]);
}

That version of optimized operation will avoid accessing field over and over again.

comparators use cast at object level: ``` public IntComparator comparator(NativeArray values) { DoubleArray that = (DoubleArray)values; return (a,b) -> Double.compare(this.array[a], that.array[b]); } ``` it can be transformed to: ``` public IntComparator comparator(NativeArray values) { double[] other = values.$array(); return (a,b) -> Double.compare(this.array[a], other[b]); } ``` That version of optimized operation will avoid accessing field over and over again.
ranides 커밋 3 년 전에서 이 이슈 언급
로그인하여 이 대화에 참여
마일스톤 없음
담당자 없음
참여자 1명
로딩중...
취소
저장
아직 콘텐츠가 없습니다.