Commit 729ad758 authored by Brian White's avatar Brian White Committed by Rod Vagg
Browse files

url: improve url.parse() performance

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: https://github.com/nodejs/node/pull/4892


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarRyan Graham <r.m.graham@gmail.com>
Reviewed-By: default avatarJohan Bergström <bugs@bergstroem.nu>
parent df93d60c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment