Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
url: improve parsing speed
Browse files Browse the repository at this point in the history
The url.parse() function now checks whether an escapable character is in
the URL before trying to escape it.

PR-URL: #8638
[trev.norris@gmail.com: Switch to use continue instead of if]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
CGavrila authored and trevnorris committed Dec 30, 2014
1 parent 890baa0 commit 6a03fce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6a03fce

Please sign in to comment.