From 6a03fce16eaa4ec1085463d94734d40b370f3ea4 Mon Sep 17 00:00:00 2001 From: CGavrila Date: Tue, 28 Oct 2014 12:08:37 +0000 Subject: [PATCH] url: improve parsing speed The url.parse() function now checks whether an escapable character is in the URL before trying to escape it. PR-URL: https://github.com/joyent/node/pull/8638 [trev.norris@gmail.com: Switch to use continue instead of if] Signed-off-by: Trevor Norris --- lib/url.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/url.js b/lib/url.js index 0302fda142..ac82d25117 100644 --- a/lib/url.js +++ b/lib/url.js @@ -318,6 +318,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { // need to be. for (var i = 0, l = autoEscape.length; i < l; i++) { var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; var esc = encodeURIComponent(ae); if (esc === ae) { esc = escape(ae);