Brian White
7cd0d4f644
buffer: fix backwards incompatibility
...
4a86803f6 introduced a backwards incompatibility by accident
and was not caught due to an existing test that wasn't strict enough.
This commit fixes both the backwards incompatibility and the test.
PR-URL: https://github.com/nodejs/node/pull/12439
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-04-18 08:47:11 -07:00
Brian White
ccdcd9168a
benchmark: improve cli error message
...
When no matching benchmark files are found, a more sensible error
is shown now.
PR-URL: https://github.com/nodejs/node/pull/12421
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-04-17 14:48:40 -07:00
Brian White
e0f0f2664e
buffer: use slightly faster NaN check
...
PR-URL: https://github.com/nodejs/node/pull/12286
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-04-14 18:01:43 -04:00
Brian White
4749ec2aa3
buffer: optimize write()
...
PR-URL: https://github.com/nodejs/node/pull/12361
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-04-14 22:36:46 +02:00
Brian White
3ee4a1a281
buffer: optimize toString()
...
PR-URL: https://github.com/nodejs/node/pull/12361
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-04-14 22:36:42 +02:00
Brian White
4a86803f60
buffer: optimize from() and byteLength()
...
PR-URL: https://github.com/nodejs/node/pull/12361
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-04-14 22:35:59 +02:00
Brian White
b76a350a19
url: avoid instanceof for WHATWG URL
...
PR-URL: https://github.com/nodejs/node/pull/11690
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-04-04 17:36:37 -07:00
Brian White
b40dab553f
linkedlist: remove unused methods
...
PR-URL: https://github.com/nodejs/node/pull/11726
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
2017-04-04 10:59:44 -07:00
Brian White
84a23391f6
linkedlist: remove public module
...
PR-URL: https://github.com/nodejs/node/pull/12113
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-04-04 10:05:04 -07:00
Brian White
61ebfa8d1f
tools: add unescaped regexp dot rule to linter
...
PR-URL: https://github.com/nodejs/node/pull/11834
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-03-29 10:53:28 +02:00
Brian White
71097744b2
fs: more realpath*() optimizations
...
Including:
* Skip URL instance check for common (string) cases
* Avoid regexp on non-Windows platforms when parsing the root of a path
* Skip call to `getOptions()` in common case where no `options` is passed
* Avoid `hasOwnProperty()`
PR-URL: https://github.com/nodejs/node/pull/11665
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-03-14 21:54:48 -07:00
Brian White
6a5ab5d550
fs: include more fs.stat*() optimizations
...
Including:
* Move async *stat() functions to FillStatsArray() now used by the
sync *stat() functions
* Avoid creating fs.Stats instances for implicit async/sync *stat()
calls used in various fs functions
* Store reference to Float64Array data on C++ side for easier/faster
access, instead of passing from JS to C++ on every async/sync *stat()
call
PR-URL: https://github.com/nodejs/node/pull/11665
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-03-14 21:54:40 -07:00
Brian White
c67207731f
lib: simplify Module._resolveLookupPaths
...
This commit consists of two changes:
* Avoids returning request/id *just* for the debug() output
* Returns `null` instead of an empty array for the list of paths
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:59 -05:00
Brian White
e32425bfcd
module: avoid JSON.stringify() for cache key
...
By avoiding JSON.stringify() and simply joining the strings with a
delimiter that does not appear in paths, we can improve cached
require() performance by at least 50%.
Additionally, this commit removes the last source of permanent
function deoptimization (const) for _findPath().
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:53 -05:00
Brian White
28dc848e70
lib: improve method of function calling
...
Using a more "direct" method of function calling yields better
performance.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:46 -05:00
Brian White
403b89e72b
module: avoid hasOwnProperty()
...
hasOwnProperty() is known to be slow, do a direct lookup on a "clean"
object instead.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:41 -05:00
Brian White
298a40e04e
module: use "clean" objects
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:38 -05:00
Brian White
a851b868c0
lib: remove sources of permanent deopts
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:35 -05:00
Brian White
1c3df96570
fs: replace regexp with function
...
Replacing the path separator-finding regexp with a custom function
results in a measurable improvement in performance.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:31 -05:00
Brian White
34c9fc2e4e
fs: avoid multiple conversions to string
...
nullCheck() implicitly converts the argument to string when checking
the value, so this commit avoids any unnecessary additional (Buffer)
conversions to string.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:24 -05:00
Brian White
21b2440176
fs: avoid recompilation of closure
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:20 -05:00
Brian White
190dc69c89
benchmark: add parameter for module benchmark
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:46:36 -05:00
Brian White
e4fbd8e244
test: add more WHATWG URL origin tests
...
PR-URL: https://github.com/nodejs/node/pull/11691
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-09 08:58:55 -05:00
Brian White
7afc70de40
url: remove invalid file protocol check
...
'file' should have been 'file:' but since the WHATWG URL spec
suggests using an opaque origin (which is what was already being
used for file URLs), we'll just keep using that, making this merely
a cleanup.
PR-URL: https://github.com/nodejs/node/pull/11691
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-09 08:56:51 -05:00
Brian White
d3480776c7
http: concatenate outgoing Cookie headers
...
This commit enables automatic concatenation of multiple Cookie header
values with a semicolon, except when 2D header arrays are used.
Fixes: https://github.com/nodejs/node/issues/11256
PR-URL: https://github.com/nodejs/node/pull/11259
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-03-09 08:10:30 -05:00
Brian White
6b2cef65c9
http: append Cookie header values with semicolon
...
Previously, separate incoming Cookie headers would be concatenated
with a comma, which can cause confusion in userland code when it
comes to parsing the final Cookie header value. This commit
concatenates using a semicolon instead.
Fixes: https://github.com/nodejs/node/issues/11256
PR-URL: https://github.com/nodejs/node/pull/11259
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-03-09 08:10:25 -05:00
Brian White
8243ca0e0e
http: reuse existing StorageObject
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:23 -05:00
Brian White
b377034359
http: support old private properties and function
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:23 -05:00
Brian White
940b5303be
http: use Symbol for outgoing headers
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:22 -05:00
Brian White
86996c5838
doc: deprecate private http properties
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:18 -05:00
Brian White
4e05952a8a
os: improve cpus() performance
...
PR-URL: https://github.com/nodejs/node/pull/11564
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
2017-03-02 15:31:21 -05:00
Brian White
22abb39b2c
fs: improve performance for sync stat() functions
...
PR-URL: https://github.com/nodejs/node/pull/11522
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-02-25 20:58:42 -05:00
Brian White
efdc571a58
os: improve loadavg() performance
...
PR-URL: https://github.com/nodejs/node/pull/11516
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-02-25 20:53:56 -05:00
Brian White
f385f77f1d
process: improve memoryUsage() performance
...
Creating an object in JS and using a typed array to transfer values
from C++ to JS is faster than creating an object and setting
properties in C++.
The included benchmark shows ~34% increase in performance with this
change.
PR-URL: https://github.com/nodejs/node/pull/11497
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-02-23 17:19:39 -08:00
Brian White
29ff16f043
build: fix newlines in addon build output
...
Interpretation of escape sequences with echo is not as consistent
across platforms as printf, so use the latter instead.
PR-URL: https://github.com/nodejs/node/pull/11466
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-02-22 22:01:14 -05:00
Brian White
3e6f1032a4
http: add new functions to OutgoingMessage
...
PR-URL: https://github.com/nodejs/node/pull/10805
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2017-02-20 16:50:43 -05:00
Brian White
a08fcc02f8
benchmark: fix timer display in progress output
...
This commit fixes an issue where the minutes would not display
properly on the benchmark timer once an hour had elapsed.
PR-URL: https://github.com/nodejs/node/pull/11235
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-02-16 16:22:56 -08:00
Brian White
8bcc122349
test: improve querystring.parse assertion messages
...
PR-URL: https://github.com/nodejs/node/pull/11234
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com >
2017-02-13 10:40:45 -08:00
Brian White
ff785fd517
querystring: fix empty pairs and optimize parse()
...
This commit fixes handling of empty pairs that occur before the end
of the query string so that they are also ignored.
Additionally, some optimizations have been made, including:
* Avoid unnecessary code execution where possible
* Use a lookup table when checking for hex characters
* Avoid forced decoding when '+' characters are encountered and we
are using the default decoder
Fixes: https://github.com/nodejs/node/issues/10454
PR-URL: https://github.com/nodejs/node/pull/11234
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com >
2017-02-13 10:40:37 -08:00
Brian White
24ef1e6775
string_decoder: align UTF-8 handling with V8
...
V8 5.5 changed how invalid characters are handled and it now appears
to follow the WHATWG Encoding standard, where all of an invalid
character's bytes are replaced by a single replacement character
(\ufffd) instead of replacing each invalid byte with separate
replacement characters.
Example: the byte sequence 0xF0,0xB8,0x41 is decoded as '\ufffdA' in
V8 5.5, but is decoded as '\ufffd\ufffdA' in previous versions of V8.
PR-URL: https://github.com/nodejs/node/pull/9618
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-01-26 22:46:18 +01:00
Brian White
3bdcbdb1a0
querystring: improve unescapeBuffer performance
...
PR-URL: https://github.com/nodejs/node/pull/10837
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-25 02:22:26 -05:00
Brian White
05f38be556
querystring: improve stringify() performance
...
PR-URL: https://github.com/nodejs/node/pull/10852
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com >
2017-01-25 02:15:03 -05:00
Brian White
2298bc4b1f
querystring: improve parse() performance
...
PR-URL: https://github.com/nodejs/node/pull/10874
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-25 02:05:26 -05:00
Brian White
9e0f6a5eb4
buffer: improve compare() performance
...
PR-URL: https://github.com/nodejs/node/pull/10927
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-25 01:42:42 -05:00
Brian White
9fcd842279
buffer: improve toJSON() performance
...
PR-URL: https://github.com/nodejs/node/pull/10895
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michal Zasso <targos@protonmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-23 13:26:30 +01:00
Brian White
57e2ec4356
test: add http.ClientRequest defaults test
...
PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-01-13 16:11:19 -05:00
Brian White
c5d0fd9641
benchmark: add ClientRequest creation benchmark
...
PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-01-13 16:11:19 -05:00
Brian White
2f7759640e
http: misc ClientRequest cleanup
...
PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-01-13 16:11:18 -05:00
Brian White
15c6187aa5
http: avoid duplicate isArray()
...
PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-01-13 16:11:18 -05:00
Brian White
dab22b5b7a
http: optimize default method case
...
PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-01-13 16:11:18 -05:00
Brian White
5c2ef14f21
http: optimize short path validation
...
PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2017-01-13 16:11:17 -05:00
Brian White
c001d2aab5
benchmark: don't lint autogenerated modules
...
PR-URL: https://github.com/nodejs/node/pull/10756
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-01-12 08:13:54 -08:00
Brian White
03b9f6fe26
stream: avoid instanceof
...
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:55:04 -05:00
Brian White
a3539ae3be
stream: use plain objects for write/corked reqs
...
This is similar to a change made awhile back for storing
process.nextTick() requests.
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:59 -05:00
Brian White
b888bfe81d
benchmark: allow zero when parsing http req/s
...
Without this, the http benchmarker would report "strange output" if
wrk or any other http client reported 0 requests per second, which is
a valid result.
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:49 -05:00
Brian White
176cdc2823
http: misc optimizations and style fixes
...
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:45 -05:00
Brian White
73d9445782
http: try to avoid lowercasing incoming headers
...
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:41 -05:00
Brian White
c77ed327d9
http: avoid using object for removed header status
...
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:36 -05:00
Brian White
c00e4adbb4
http: optimize header storage and matching
...
This commit implements two optimizations when working with headers:
* Avoid having to explicitly "render" headers and separately store the
original casing for header names.
* Match special header names using a single regular expression instead
of testing one regular expression per header name.
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:31 -05:00
Brian White
ec8910bcea
http: check statusCode early
...
By enforcing the statusCode to be an SMI, it helps a bit
performance-wise when looking up the associated statusMessage.
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:54:26 -05:00
Brian White
f53a6fb48b
benchmark: add http header setting scenarios
...
PR-URL: https://github.com/nodejs/node/pull/10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-01-11 12:52:57 -05:00
Brian White
0a937280d8
stream: avoid additional validation for Buffers
...
These changes result in ~50% improvement in the included benchmark.
PR-URL: https://github.com/nodejs/node/pull/10580
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-05 02:58:05 -05:00
Brian White
aab1dd6ff4
events: improve removeListener() performance
...
array.shift() seems to be faster than arrayClone() when the item
to remove is at the front (at least with V8 5.4).
PR-URL: https://github.com/nodejs/node/pull/10572
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-01-05 02:53:18 -05:00
Brian White
7889416b8a
benchmark: keep decimals in results
...
Some benchmarks' results are small values, so keeping decimals when
running them manually (not comparing) can be helpful.
PR-URL: https://github.com/nodejs/node/pull/10559
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-05 02:48:07 -05:00
Brian White
f955c734ba
benchmark: improve readability of net benchmarks
...
PR-URL: https://github.com/nodejs/node/pull/10446
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-05 02:42:01 -05:00
Brian White
d43b14495c
benchmark: move punycode benchmark out of net
...
punycode/ICU is not specific to any particular module, so move it to
a more generic location.
PR-URL: https://github.com/nodejs/node/pull/10446
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-01-05 02:41:22 -05:00
Brian White
4d7531de24
http: optimize headers iteration
...
This commit uses instanceof instead of Array.isArray() for faster
type checking and avoids calling Object.keys() when the headers are
stored as a 2D array instead of a plain object.
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:19:14 -05:00
Brian White
af74e72a9f
http: simplify boolean checks
...
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:19:10 -05:00
Brian White
e8b809a7a0
http: extract validation functions
...
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:19:07 -05:00
Brian White
b6ea857c7d
lib: avoid recompilation of anonymous functions
...
Since at least V8 5.4, using function.bind() is now fast enough to
use to avoid recompiling/reoptimizing the same anonymous functions.
These changes especially impact http servers.
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:19:03 -05:00
Brian White
a54972c195
http: improve validation performance
...
The new table-based lookups perform significantly better for the
common cases (checking latin1 characters).
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:19:00 -05:00
Brian White
832271c88f
http: refactor server connection handling
...
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:18:57 -05:00
Brian White
14c76f8671
http: misc cleanup and minor optimizations
...
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:18:53 -05:00
Brian White
175ed520c1
http: reuse existing headers array for raw values
...
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2016-12-29 14:18:49 -05:00
Brian White
4c9dd6822e
events: improve once() performance
...
This commit takes advantage of the performance improvements V8 has
made to function.bind() in V8 5.4 and uses it to avoid constant
recompilation/reoptimization of the wrapper closure used in once().
This change results in ~27% performance increase for once().
PR-URL: https://github.com/nodejs/node/pull/10445
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-12-28 21:23:25 -05:00
Brian White
13a4887ee9
buffer: improve allocation performance
...
assertSize() is adjusted to be inlineable according to V8's default
function size limits when determining inlineability. This results in
up to 11% performance gains when allocating any kind of Buffer.
Avoid avoids use of in, resulting in ~50% improvement when creating
a Buffer from an array-like object.
PR-URL: https://github.com/nodejs/node/pull/10443
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2016-12-27 14:57:06 -08:00
Brian White
17eb8fce05
benchmark: use commas in non-csv rate output
...
PR-URL: https://github.com/nodejs/node/pull/10360
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-12-23 23:22:59 -08:00
Brian White
f3cf8e9808
fs: do not pass Buffer when toString() fails
...
Even though an Error object is passed to the callback when readFile()
fails due to toString() failing, it is a bit strange to still see
data passed as the second argument. This commit changes that and only
passes the Error object in that case.
PR-URL: https://github.com/nodejs/node/pull/9670
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-12-14 03:29:33 -05:00
Brian White
5242114d89
doc: remove redundant warning information
...
process.emitWarning() already describes how to emit custom warnings,
so just merely provide a link to that function from the 'warning'
event documentation.
PR-URL: https://github.com/nodejs/node/pull/9590
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-11-15 21:52:10 -05:00
Brian White
71d4a7474d
doc: improve process.emitWarning() example
...
PR-URL: https://github.com/nodejs/node/pull/9590
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-11-15 21:52:01 -05:00
Brian White
ed41d8d569
src: remove unused function
...
PR-URL: https://github.com/nodejs/node/pull/9243
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-10-25 14:30:29 -07:00
Brian White
6e5389eb5a
deps: revert default gtest reporter change
...
PR-URL: https://github.com/nodejs/node/pull/8948
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-10-23 04:34:07 -04:00
Brian White
42158a0313
timers: fix regression with clearImmediate()
...
This commit fixes a regression introduced in 0ed8839a27 that caused
additional queued immediate callbacks to be ignored if
`clearImmediate(immediate)` was called within the callback for
`immediate`.
PR-URL: https://github.com/nodejs/node/pull/9086
Fixes: https://github.com/nodejs/node/issues/9084
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2016-10-14 15:57:25 -05:00
Brian White
c9dade48b4
buffer: make byteLength throw on invalid input
...
PR-URL: https://github.com/nodejs/node/pull/8946
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-10-10 12:57:27 -07:00
Brian White
0ed8839a27
timers: improve setImmediate() performance
...
This commit avoids re-creating a new immediate queue object every
time the immediate queue is processed. Additionally, a few functions
are tweaked to make them inlineable.
These changes give ~6-7% boost in setImmediate() performance in the
existing setImmediate() benchmarks.
PR-URL: https://github.com/nodejs/node/pull/8655
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2016-10-05 03:09:55 -04:00
Brian White
2893bd2fdf
src: remove unused function declaration
...
PR-URL: https://github.com/nodejs/node/pull/8878
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2016-10-03 13:02:09 +02:00
Brian White
13481d07f5
inspector: fix minor issues
...
PR-URL: https://github.com/nodejs/node/pull/8890
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2016-10-03 12:39:17 +02:00
Brian White
9eb61793bf
cluster: remove unused backlog argument
...
PR-URL: https://github.com/nodejs/node/pull/8877
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2016-10-03 12:34:46 +02:00
Brian White
c8c2544cd9
timers: improve setTimeout/Interval performance
...
This commit improves timers performance by making functions
inlineable and avoiding the creation of extra closures/functions.
This commit also makes setTimeout/Interval argument handling
consistent with that of setImmediate.
These changes give ~22% improvement in the existing 'breadth' timers
benchmark.
PR-URL: https://github.com/nodejs/node/pull/8661
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2016-10-01 02:58:42 -04:00
Brian White
73bafa0d81
buffer: fix ArrayBuffer checks
...
This commit fixes detection of ArrayBuffers from different V8 contexts.
This is especially a problem for environments like nw.js where the
node and browser V8 contexts are not shared.
PR-URL: https://github.com/nodejs/node/pull/8453
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2016-09-11 21:11:49 -07:00
Brian White
8361c26cd5
doc: fix broken link in dgram doc
...
PR-URL: https://github.com/nodejs/node/pull/8365
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2016-09-02 14:29:30 -04:00
Brian White
2cc7fa5e7d
http: remove deprecated Client interface
...
PR-URL: https://github.com/nodejs/node/pull/8104
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-08-29 21:44:58 -04:00
Brian White
1050594c86
http: fix connection upgrade checks
...
This commit fixes connection upgrade checks, specifically when headers
are passed as an array instead of a plain object to http.request()
Fixes: https://github.com/nodejs/node/issues/8235
PR-URL: https://github.com/nodejs/node/pull/8238
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-26 10:17:34 -04:00
Brian White
a206afec76
net: add length check when normalizing args
...
This helps to prevent possible deoptimizations that arise when trying
to access nonexistent indices.
PR-URL: https://github.com/nodejs/node/pull/8112
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-23 15:12:44 -04:00
Brian White
d28159f0fc
net: remove unnecessary variables
...
V8 is smart enough to optimize the length property checking when
iterating over an array with a for loop.
PR-URL: https://github.com/nodejs/node/pull/8112
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-08-23 15:12:44 -04:00
Brian White
b3127df59a
doc: add/fix version metadata for Buffer methods
...
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-07-22 17:42:28 -04:00
Brian White
ac57089960
doc: improve function parameter descriptions
...
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-07-22 17:42:24 -04:00
Brian White
3f208c70da
doc: add missing properties in Buffer docs
...
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-07-22 17:42:21 -04:00
Brian White
87a097da51
doc: improve wording and style of Buffer docs
...
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-07-22 17:42:18 -04:00
Brian White
cc1318b5ed
doc: improve links in Buffer docs
...
This commit adds more links and reuses existing link references more.
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2016-07-22 17:42:13 -04:00