Improve the Uri parsing speed
authorMiguel de Icaza <miguel@gnome.org>
Sat, 25 Sep 2010 04:04:24 +0000 (00:04 -0400)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 25 Sep 2010 04:04:24 +0000 (00:04 -0400)
commit1228fd45c7191898623e3f8397312177efdcbe40
tree14c70c600f1fb23d13ec77eb8f61f13d215dfb08
parentf485bd74bde5ff62a1b73c2e0525f9b000615e40
Improve the Uri parsing speed

This affects MonoTouch startup as our dictionaries are a little bit
slow to be created now that we use Dictionary<> hashes for switch
statements.

Some timings:

Using a simple block of if's is twice as slow as the compiler generated
switch statement.   But using this tuned code is faster than the
compiler generated code, with a million loops on x86-64:

With "http": .10 vs .51 (first check)
with "https": .16 vs .51 (second check)
with "foo": .22 vs .31 (never found)
with "mailto": .12 vs .51  (last check)
mcs/class/System/System/Uri.cs