querystring: optimize parse and stringify by mscdex · Pull Request #847 · nodejs/node

referenced this pull request in ceejbot/io.js

Feb 14, 2015
Double negation considered slower than a straight null check.

brendanashworth pushed a commit that referenced this pull request

Feb 15, 2015
PR-URL: #847
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>

@rvagg rvagg mentioned this pull request

Feb 18, 2015

@mscdex

parse optimizations:

* Move try-catch to separate function to keep entire function from
being deoptimized.
* Use key array lookup instead of using hasOwnProperty.
* Avoid decoding known empty strings.
* Avoid possibly unnecessary switch to slower decoder for values if
key decoding throws.

stringify optimizations:

* Use manual loop for default encoder instead of encodeURIComponent.
* Use string concatenation instead of joining an array of strings.
* Avoid caching result of typeof.

mscdex added a commit to mscdex/io.js that referenced this pull request

Mar 16, 2015
parse optimizations:

* Move try-catch to separate function to keep entire function from
being deoptimized.
* Use key array lookup instead of using hasOwnProperty.
* Avoid decoding known empty strings.
* Avoid possibly unnecessary switch to slower decoder for values if
key decoding throws.

stringify optimizations:

* Use manual loop for default encoder instead of encodeURIComponent.
* Use string concatenation instead of joining an array of strings.
* Avoid caching result of typeof.

PR-URL: nodejs#847
Reviewed-By: Trevor Norris <trev.norris@gmail.com>

@mscdex mscdex deleted the perf-querystring branch

March 16, 2015 03:16

@rvagg rvagg mentioned this pull request

Mar 17, 2015

@rvagg rvagg mentioned this pull request

Mar 20, 2015

rvagg added a commit that referenced this pull request

Mar 20, 2015
Notable Changes:

* path: New type-checking on path.resolve()
  <#1153> uncovered some edge-cases
  being relied upon in the wild, most notably path.dirname(undefined).
  Type-checking has been loosened for path.dirname(), path.basename(),
  and path.extname(), (Colin Ihrig)
  <#1216>.
* querystring: Internal optimizations in querystring.parse() and
  querystring.stringify() <#847>
  prevented Number literals from being properly converted via
  querystring.escape() <#1208>,
  exposing a blind-spot in the test suite. The bug and the tests have
  now been fixed (Jeremiah Senkpiel)
  <#1213>.