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: 00090a0c72

Review URL: https://codereview.chromium.org/2086613003 .
This commit is contained in:
Lasse R.H. Nielsen 2016-06-30 13:25:36 +02:00
parent 00090a0c72
commit 323ca7e410
3 changed files with 5 additions and 2 deletions

View file

@ -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`.

View file

@ -179,7 +179,7 @@ Future compileAndCheck(String code,
Future compileSources(Map<String, String> 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"');

View file

@ -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");