Open DartBot opened 11 years ago
This comment was originally written by brendandunc...@gmail.com
Woops, typo above in my example optimization. It should be:
class Float32List ... native "Float32Array" {
@JSName('set')
void _set(Float32List array, int offset) native;
@JSName('subarray')
_subarray(int begin, int end) native;
void setRange(int start, int end, Iterable<num> iterable,
[int skipCount=0]) {
if (iterable is Float32List) {
_set(iterable._subarray(skipCount, skipCount + (end - start)),
start);
} else {
IterableMixinWorkaround.setRangeList(this, start, end,
iterable, skipCount);
}
}
}
Which does work in exposing the native javascript set and subarray methods, causing setRange to use those methods if the iterable type is also a Float32List.
Removed Type-Defect label. Added Type-Enhancement, Area-Dart2JS, Triaged labels.
This comment was originally written by ngeoffray@google.com
Seems like a bug in the library code, where VM and dart2js don't have the same behavior. Florian, can you take a look?
Set owner to @floitschG. Removed Area-Dart2JS label. Added Area-Library label.
This issue was originally filed by brendandunc...@gmail.com
b will result in [0,3]. This seems good in the dart vm, I believe it's doing memory copies for setRange if the iterable is also a typed_data. But with dart2js, setRange results in a for-loop copy.
Can typed_data_dart2js.dart be optimized? Something like:
Which would use the native Float32Array set and subarray methods to more efficiently copy a subrange than a for-loop, if the iterable is the same type.
The above doesn't quite work, as I'm not sure how to properly expose the native javascript methods...
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system? Dart SDK version 0.5.20.4_r24275
Please provide any additional information below.