mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:29:47 +00:00
[vm/aot] Remove special casing of td views, allow external/internal typed data to be fast as well in string decoding
This improves the binary protobuf decoding benchmark by 6% on x64/arm64 and 17% on arm32. Issue https://github.com/dart-lang/sdk/issues/35154 Change-Id: I23ba48b79b6e2a7698707f81ae4122cb9590ed2c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98844 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
8e4dcf48c4
commit
27a58d455d
|
@ -1857,8 +1857,7 @@ int _scanOneByteCharacters(List<int> units, int from, int endIndex) {
|
|||
final to = endIndex;
|
||||
|
||||
// Special case for _Uint8ArrayView.
|
||||
final cid = ClassID.getID(units);
|
||||
if (identical(cid, ClassID.cidUint8ArrayView)) {
|
||||
if (units is Uint8List) {
|
||||
if (from >= 0 && to >= 0 && to <= units.length) {
|
||||
for (int i = from; i < to; i++) {
|
||||
final unit = units[i];
|
||||
|
|
|
@ -224,8 +224,7 @@ abstract class _StringBase implements String {
|
|||
var s = _OneByteString._allocate(len);
|
||||
|
||||
// Special case for _Uint8ArrayView.
|
||||
final cid = ClassID.getID(charCodes);
|
||||
if (identical(cid, ClassID.cidUint8ArrayView)) {
|
||||
if (charCodes is Uint8List) {
|
||||
if (start >= 0 && len >= 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
s._setAt(i, charCodes[start + i]);
|
||||
|
|
Loading…
Reference in a new issue