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

Unified Diff: sdk/lib/io/http_headers.dart

Issue 173683002: Slightly speed up http-parser and http-header-writing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Limit status code length. Created 6 years, 10 months 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 | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_headers.dart
diff --git a/sdk/lib/io/http_headers.dart b/sdk/lib/io/http_headers.dart
index 0be5c080d6d68dfb09c2e29e4a6b2845a32b4065..85706d16d23f53e12a46ca3b939639d6e7e3e7c2 100644
--- a/sdk/lib/io/http_headers.dart
+++ b/sdk/lib/io/http_headers.dart
@@ -396,25 +396,31 @@ class _HttpHeaders implements HttpHeaders {
}
// Format headers.
- _headers.forEach((String name, List<String> values) {
+ for (String name in _headers.keys) {
+ List<String> values = _headers[name];
bool fold = _foldHeader(name);
var nameData = name.codeUnits;
write(nameData);
- write(const [_CharCode.COLON, _CharCode.SP]);
+ buffer[offset++] = _CharCode.COLON;
+ buffer[offset++] = _CharCode.SP;
for (int i = 0; i < values.length; i++) {
if (i > 0) {
if (fold) {
- write(const [_CharCode.COMMA, _CharCode.SP]);
+ buffer[offset++] = _CharCode.COMMA;
+ buffer[offset++] = _CharCode.SP;
} else {
- write(const [_CharCode.CR, _CharCode.LF]);
+ buffer[offset++] = _CharCode.CR;
+ buffer[offset++] = _CharCode.LF;
write(nameData);
- write(const [_CharCode.COLON, _CharCode.SP]);
+ buffer[offset++] = _CharCode.COLON;
+ buffer[offset++] = _CharCode.SP;
}
}
write(values[i].codeUnits);
}
- write(const [_CharCode.CR, _CharCode.LF]);
- });
+ buffer[offset++] = _CharCode.CR;
+ buffer[offset++] = _CharCode.LF;
+ }
return offset;
}
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698