Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: pkg/analyzer/lib/src/summary/api_signature.dart

Issue 2474993004: Optimize ApiSignature.addBytes() (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/api_signature.dart
diff --git a/pkg/analyzer/lib/src/summary/api_signature.dart b/pkg/analyzer/lib/src/summary/api_signature.dart
index 230b6d02a1f15f6e50c95b789bd98d759765f160..d8c29c6c4d1adf93bcc4553f627481fa9922e0a9 100644
--- a/pkg/analyzer/lib/src/summary/api_signature.dart
+++ b/pkg/analyzer/lib/src/summary/api_signature.dart
@@ -72,10 +72,12 @@ class ApiSignature {
* `addBytes([1]); addBytes([2]);`.
*/
void addBytes(List<int> bytes) {
- _makeRoom(bytes.length);
- new Uint8List.view(_data.buffer)
- .setRange(_offset, _offset + bytes.length, bytes);
- _offset += bytes.length;
+ int length = bytes.length;
+ _makeRoom(length);
+ for (int i = 0; i < length; i++) {
+ _data.setUint8(_offset + i, bytes[i]);
+ }
+ _offset += length;
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698