Uh oh!
There was an error while loading. Please reload this page.
querystring: improve querystring unescapeBuffer perf - #12525
Conversation
Refactored the unescapeBuffer function in order to simplify it, and also to improve the performance. The benchmark: ```improvement confidence p.value querystring/querystring-unescapebuffer.js n=1000000 input="%20%21%2..." 18.10 % *** 6.671620e-29 querystring/querystring-unescapebuffer.js n=1000000 input="there%20..." 2.75 % * 1.775320e-02 querystring/querystring-unescapebuffer.js n=1000000 input="there%2Q..." 34.12 % *** 8.074612e-25 querystring/querystring-unescapebuffer.js n=1000000 input="there is..." 27.92 % *** 4.923348e-29 ```
vsemozhetbyt
commented
Apr 19, 2017
| return hasHex ? out.slice(0, outIndex) : out; | ||
| } | ||
There was a problem hiding this comment.
What is the standard? Because the file contains both 2 and 1 line separation between functions.
There was a problem hiding this comment.
My own opinion is that such changes should be addressed separately.
| if (c === 37 /*'%'*/ && index < maxLength) { | ||
| c = s.charCodeAt(++index); | ||
| n = unhexTable[c]; | ||
| if (n < 0) { |
There was a problem hiding this comment.
This won't work for characters not in the table. This is why I had used !(n >= 0), which will cover undefined as well.
| } else { | ||
| c1 = s.charCodeAt(++index); | ||
| m = unhexTable[c1]; | ||
| if (m < 0) { |
mscdex
commented
Apr 19, 2017
The subsystem target in the commit message should be |
jseijas
commented
Apr 19, 2017
@mscdex subsystem changed, also the three changes asked commited. |
| if (c === 37 /*'%'*/ && index < maxLength) { | ||
| c = s.charCodeAt(++index); | ||
| n = unhexTable[c]; | ||
| if !(n >= 0) { |
There was a problem hiding this comment.
Missing parens. These sorts of things should be caught by make jslint.
| } else { | ||
| c1 = s.charCodeAt(++index); | ||
| m = unhexTable[c1]; | ||
| if !(m >= 0) { |
jseijas
commented
Apr 19, 2017
@mscdex sorry, fixed, lint passing ok, also tests. |
| break; | ||
| var index = 0; | ||
| var outIndex = 0; | ||
| var c, c1, n, m; |
There was a problem hiding this comment.
Can we name these better and place them on separate lines?
mscdex
commented
Apr 24, 2017
My benchmark results seem to agree more or less with those already posted. |
Rename variables and separate in lines.
jseijas
commented
Apr 25, 2017
@mscdex Variables renamed and separated in lines. Lint passing. UT passing. Benchmark times remains similar. |
mscdex
commented
Apr 25, 2017
jseijas
commented
May 23, 2017
Hi @mscdex! Do you need more changes to be made, or you are ok with this? I see that not all the CI is passing :( |
lpinca
commented
May 23, 2017
SGTM. |
@jseijas It's fine if CI still checks out and there are no performance regressions. Can you please rebase against current master and re-run the benchmarks? I think V8 5.8 was added since this PR was opened and may/may not have an impact on this. |
jseijas
commented
May 23, 2017
@mscdex Of course I can :) I will come back with the results. |
jseijas
commented
May 23, 2017
@mscdex Done. Now is even better. |
mscdex
commented
May 24, 2017
LGTM |
lpinca
commented
May 26, 2017
Landed in 19685ea. |
Refactored the `unescapeBuffer` function in order to simplify it, and also to improve the performance. PR-URL: #12525 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Refactored the `unescapeBuffer` function in order to simplify it, and also to improve the performance. PR-URL: #12525 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
MylesBorins
commented
Jul 17, 2017
should this land in LTS? If so it will need to bake a bit longer. Please change labels as appropriate |
Refactored the unescapeBuffer function in order to simplify it,
and also to improve the performance.
The benchmark:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)