Add fast path for simple URL parsing
authorGabriel Wicke <wicke@wikidev.net>
Tue, 1 Jul 2014 19:28:49 +0000 (12:28 -0700)
committerFedor Indutny <fedor@indutny.com>
Thu, 31 Jul 2014 18:56:46 +0000 (22:56 +0400)
commit4b59db008cec1bfcca2783f4b27c630c9c3fdd73
treeb2b5751de9a8d2240f5e715dd7c847ae6b07b31e
parentff6117b8ed57089001bdc3659b79d23bea1107fe
Add fast path for simple URL parsing

This patch adds a fast path for parsing of simple path-only URLs, as commonly
found in HTTP requests received by a server.

Benchmark results [ms], before / after patch:
/foo/bar              0.008956   0.000418 (fast path used)
http://example.com/   0.011426   0.011437 (normal slow path, no change)

In a simple 'ab' benchmark of a single-threaded web server, this patch
increases the request rate from around 6400 to 7400 req/s.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
lib/url.js