Skip to content

Commit

Permalink
url: improve url.parse() performance
Browse files Browse the repository at this point in the history
This commit improves url.parse() performance by 50-210%
with the existing url/url-parse benchmarks. Also, the
optimizations made in url.format() result in a 40%
increase in performance for url.resolve().

Some optimization strategies used in this commit include:
* Combining multiple searches on the same string into a
   single loop
* Avoiding unnecessary string.split() and array.join()
* Minimizing creation of temporary strings
* Using a faster alternative to encodeURIComponent,
   borrowed from the querystring module

PR-URL: #4892
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ryan Graham <r.m.graham@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
mscdex authored and rvagg committed Feb 21, 2016
1 parent df93d60 commit 729ad75
Showing 1 changed file with 414 additions and 153 deletions.
Loading

0 comments on commit 729ad75

Please sign in to comment.