Uh oh!
There was an error while loading. Please reload this page.
url: improve url.parse() performance - #4892
Conversation
mscdex
commented
Jan 27, 2016
FWIW here is the output from the url-parse benchmark: |
mscdex
commented
Jan 27, 2016
silverwind
commented
Jan 27, 2016
Is this related to #2303? |
mscdex
commented
Jan 27, 2016
@silverwind I hadn't seen that PR before this. However, trying that other PR (just This PR passes the existing tests and diverges less from the original code (FWIW). |
mscdex
commented
Jan 27, 2016
I made the |
jasnell
commented
Jan 27, 2016
LGTM if CI is green |
jasnell
commented
Jan 27, 2016
Marking this as lts-watch but I definitely think we need to wait to land until after it goes out in a stable for a few weeks. |
1f2ac71 to
c492001CompareFishrock123
commented
Jan 29, 2016
uh... cc @domenic maybe? |
mscdex
commented
Jan 31, 2016
Hrmm, somehow the CI job got lost. Here it is again: https://ci.nodejs.org/job/node-test-pull-request/1463/ |
jasnell
commented
Feb 1, 2016
CI looks good, but might be worth getting a citgm run on this. /cc @thealphanerd |
There was a problem hiding this comment.
Just curious: Did var turn out to be faster than the scoped variants?
There was a problem hiding this comment.
The resolveObject() changes were mostly unintentional as the url module was modified while I was working on this. However, the reverting of letis intentional as let is still slow in v8. I've left the const as-is though.
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
MylesBorins
commented
Feb 6, 2016
citgm: https://ci.nodejs.org/job/thealphanerd-smoker/62/ note: run with this patched node https://github.com/TheAlphaNerd/node/tree/improve-url-parse |
mscdex
commented
Feb 7, 2016
Looking at the citgm results the only non-flaky error result is the |
mscdex
commented
Feb 17, 2016
/cc @nodejs/collaborators Any other comments/LGTMs for this? As far as the other url performance PRs go, I'm not opposed to them if they improve performance even more than this PR. However this PR already passes all tests and is more conservative since it preserves the original |
rmg
commented
Feb 17, 2016
LGTM, but I haven't looked at any of the other PRs. |
jbergstroem
commented
Feb 18, 2016
I'm LGTM as well -- I get the impression that the other PR needs more work/review; hopefully will land at a later stage. |
silverwind
commented
Feb 18, 2016
mcollina
commented
Feb 18, 2016
So, I propose we get this in asap, and possibly backport to LTS. |
rvagg
commented
Feb 18, 2016
These major perf rewrites are not great candidates for LTS cause of their higher risk of finding edge-cases that we won't otherwise find. We improve the chances with letting them bake in v5 for a while but it doesn't make the risk disappear completely. As it stands I'm -1 on this for v4 unless someone wants to make a case that it's not as major as it looks. |
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
commented
Feb 18, 2016
Landed in db91281. |
jbergstroem
commented
Feb 18, 2016
I'm with @rvagg here. I think in general we could be too frisky with backports -- I prefer the more anal "bugfixes only" to avoid corner cases. |
petkaantonov
commented
Feb 18, 2016
performance is a feature |
STRML
commented
Feb 18, 2016
👍 Never know what could be broken months down the line. Glad to see this merged regardless for 5+. |
Trott
commented
Feb 18, 2016
It looks like this was landed three weeks after its last CI run happened. In the intervening time, new lint rules were added. So now |
mscdex
commented
Feb 18, 2016
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>
geek
commented
Feb 23, 2016
Related issue: |
MylesBorins
commented
Mar 1, 2016
@nodejs/lts this commit introduced some regressions, there are fixes coming in or already in I believe. Is this something we will want to back port if we have the fixes and it has been stable for a bit? Part of me want to just say don't land, and avoid potential regressions... but this is some pretty major churn. |
Fishrock123
commented
Mar 1, 2016
@thealphanerd I would delay a while. Same with my timers thing. |
jasnell
commented
Mar 2, 2016
@thealphanerd ... I'm going to say hold off for now. There are too many regressions on this. Even with the fixes coming this should sit for a while in master and v5 before we pull it back to v4. |
jasnell
commented
Mar 2, 2016
In fact, let's take the lts-watch label off and put the don't land in v4 label on. We can revisit later once we're sure things are stable and the regressions are handled. |
rvagg
commented
Mar 3, 2016
I'm a strong -1 on putting this or similar performance commits on to LTS, for simple and clearly low-risk commits we can consider on a case-by-case basis but these introduce too much variability into LTS which we are committed to keeping stable. It's important we achieve and maintain trust with users and give them zero reason to fear upgrading from release to release. |
jasnell
commented
Mar 3, 2016
Agree. While I'd love to get performance improvements into LTS in general if possible, these kinds of changes are far too invasive, I think, and open too many possible risks for LTS. Unfortunately, however, not landing them could make cherrypicking more difficult later but we knew that going in. |
MylesBorins
commented
Mar 17, 2016
If this does come it needs to land with #5300 |
benjamingr
commented
Mar 23, 2016
Just noting #5300 has been landed. |
mscdex
commented
Mar 23, 2016
@benjamingr I think @thealphanerd meant if it landed on v4.x. |
benjamingr
commented
Mar 23, 2016
Oh, I saw that the lts-watch has been removed, reading it again it looks like it isn't landing on 4.x either. Sorry. |
This commit improves
url.parse()performance by 50-200% with the existing url/url-parse benchmarks. Also, the optimizations made inurl.format()result in a 40% increase in performance forurl.resolve().Some optimization strategies used in this commit include:
single loop
string.split()andarray.join()borrowed from the
querystringmodule