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

Unified Diff: sdk/lib/convert/latin1.dart

Issue 208693008: Speed up ASCII, LATIN1, UTF8 converters, for single-byte codeunits. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
Index: sdk/lib/convert/latin1.dart
diff --git a/sdk/lib/convert/latin1.dart b/sdk/lib/convert/latin1.dart
index 033f8dd6e5093730a8e635c1c753d011dc0bfc55..603c249b3416133bcaf37accf3a48bdd2cf96928 100644
--- a/sdk/lib/convert/latin1.dart
+++ b/sdk/lib/convert/latin1.dart
@@ -127,11 +127,20 @@ class _Latin1DecoderSink extends ByteConversionSinkBase {
// _sink.addSlice(source, start, end, isLast).
// The code below is an incredibly stupid workaround until a real
// solution can be made.
Lasse Reichstein Nielsen 2014/03/24 09:21:01 Is it still incredibly stupid, or can we downgrade
Anders Johnsen 2014/03/24 12:01:01 Done.
- _sink.add(new String.fromCharCodes(source.getRange(start, end)));
+ if (start == 0 && end == source.length) {
+ _sink.add(new String.fromCharCodes(source));
+ } else {
+ _sink.add(new String.fromCharCodes(source.sublist(start, end)));
+ }
if (isLast) close();
}
void addSlice(List<int> source, int start, int end, bool isLast) {
+ // If Uint8List, just add dircetly.
+ if (source is Uint8List || source is Int8List) {
Lasse Reichstein Nielsen 2014/03/24 09:21:01 Int8List isn't safe. It can contain negative numbe
Anders Johnsen 2014/03/24 12:01:01 Done.
+ _addSliceToSink(source, start, end, isLast);
+ return;
+ }
if (start < 0 || start > source.length) {
throw new RangeError.range(start, 0, source.length);
}
« no previous file with comments | « sdk/lib/convert/convert.dart ('k') | sdk/lib/convert/utf.dart » ('j') | sdk/lib/convert/utf.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698