From 323ca7e410765f98a88d078c8c8c388fd972eba9 Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Thu, 30 Jun 2016 13:25:36 +0200 Subject: [PATCH] Add fast-mode Uri class. Optimize parser and make it recognize a class of URIs that don't need extra handling: no escapes, no funny characters, already (nearly or completely) normalized. Have a class specifically for those URIs which retains the original input string without having allocate any further strings. R=floitsch@google.com Committed: https://github.com/dart-lang/sdk/commit/00090a0c7237b636a73f048e53966879e74ec55a Review URL: https://codereview.chromium.org/2086613003 . --- CHANGELOG.md | 3 +++ tests/compiler/dart2js/compiler_helper.dart | 2 +- tests/corelib/uri_test.dart | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f44d60e4ae..23a3e2a188e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ### Core library changes +* `dart:core` + * Improved performance when parsing some common URIs. + * Fixed bug in `Uri.resolve` (SDK issue [26804](https://github.com/dart-lang/sdk/issues/26804)). * `dart:io` * Adds file locking modes `FileLock.BLOCKING_SHARED` and `FileLock.BLOCKING_EXCLUSIVE`. diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart index e365f3b82c0..2c1684ef12e 100644 --- a/tests/compiler/dart2js/compiler_helper.dart +++ b/tests/compiler/dart2js/compiler_helper.dart @@ -179,7 +179,7 @@ Future compileAndCheck(String code, Future compileSources(Map sources, check(MockCompiler compiler)) { - Uri base = new Uri(scheme: 'source'); + Uri base = new Uri(scheme: 'source', path: '/'); Uri mainUri = base.resolve('main.dart'); String mainCode = sources['main.dart']; Expect.isNotNull(mainCode, 'No source code found for "main.dart"'); diff --git a/tests/corelib/uri_test.dart b/tests/corelib/uri_test.dart index 0b1e0ee7764..5d8ce189043 100644 --- a/tests/corelib/uri_test.dart +++ b/tests/corelib/uri_test.dart @@ -196,7 +196,7 @@ testUriPerRFCs() { testResolve("s://h/", "../../../.."); testResolve("s://h/", "../../../../"); - base = Uri.parse("s://h/p?q#f%20"); // A non-simpe base + base = Uri.parse("s://h/p?q#f%20"); // A non-simpe base. // Simple references: testResolve("s2://h2/P?Q#F", "s2://h2/P?Q#F"); testResolve("s://h2/P?Q#F", "//h2/P?Q#F");