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

Unified Diff: runtime/lib/string_base.dart

Issue 11419194: Improve performance of String.split for 1 and 0 character results. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « runtime/lib/math_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string_base.dart
===================================================================
--- runtime/lib/string_base.dart (revision 15427)
+++ runtime/lib/string_base.dart (working copy)
@@ -152,6 +152,12 @@
if (startIndex > endIndex) {
throw new RangeError.value(startIndex);
}
+ if (startIndex == endIndex) {
+ return "";
+ }
+ if ((startIndex + 1) == endIndex) {
+ return this[startIndex];
+ }
return _substringUnchecked(startIndex, endIndex);
}
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698