dylan-lang/uri — pull request #3 by fracek (2014-01-25 12:32:38+00:00)
Title: Improve parse-uri-as

I worked on this because `parse-url` was a bottleneck in http-server, I replaced the regex with a hand-written parser.

I wrote a quick benchamark to see if and by how much this improved `parse-uri-as`:

```dylan
define test uri-base-bench-test ()
for (i from 0 to 1e6)
let uri = parse-uri("http://a/b/c/d;p?q#f");
check-equal("base-uri fragment", uri.uri-fragment, "f");
end for;
end;
```

before:

```
Running test uri-base-bench-test: PASSED in 89.533051s

uri-base-bench-test PASSED in 89.533051 seconds:
Ran 0 suites: 0 passed (100.00000%), 0 failed, 0 skipped, 0 not implemented, 0 crashed
Ran 1 test: 1 passed (100.00000%), 0 failed, 0 skipped, 0 not implemented, 0 crashed
Ran 1000001 checks: 1000001 passed (100.00000%), 0 failed, 0 skipped, 0 not implemented, 0 crashed
```

after:

```
Running test uri-base-bench-test: PASSED in 44.769050s

uri-base-bench-test PASSED in 44.769050 seconds:
Ran 0 suites: 0 passed (100.00000%), 0 failed, 0 skipped, 0 not implemented, 0 crashed
Ran 1 test: 1 passed (100.00000%), 0 failed, 0 skipped, 0 not implemented, 0 crashed
Ran 1000001 checks: 1000001 passed (100.00000%), 0 failed, 0 skipped, 0 not implemented, 0 crashed
```

The bottlenecks in `parse-uri-as` are now `split-path` and `percent-decode`.

I don't like the `let (_scheme, _foo) = ...; scheme := _scheme` thing, so ideas on how to improve that are welcome.

All tests are passing.