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

Unified Diff: pkg/i18n/lib/date_format_helpers.dart

Issue 10836319: Improve i18n date/time test performance (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | pkg/i18n/test/date_time_format_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/i18n/lib/date_format_helpers.dart
===================================================================
--- pkg/i18n/lib/date_format_helpers.dart (revision 10918)
+++ pkg/i18n/lib/date_format_helpers.dart (working copy)
@@ -125,10 +125,12 @@
* Assuming that the contents are characters, read as many digits as we
* can see and then return the corresponding integer. Advance the stream.
*/
+ var digitMatcher = const RegExp(@'\d');
int nextInteger() {
- var validDigits = '0123456789';
+ // Doing this with a regular expression is slightly slower on the VM,
+ // but makes a moderate difference in Javascript right now.
Emily Fortuna 2012/08/18 00:46:30 perhaps we could do something a little fancier lik
var digits = [];
- while (!atEnd() && (validDigits.contains(peek()))) {
+ while (!atEnd() && (digitMatcher.hasMatch(peek()))) {
digits.add(next().charCodeAt(0));
}
return Math.parseInt(new String.fromCharCodes(digits));
« no previous file with comments | « no previous file | pkg/i18n/test/date_time_format_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698