0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
Commit Graph

534 Commits

Author SHA1 Message Date
Teddy Katz
b1b1978ec5
tools: add additional ESLint rules
PR-URL: https://github.com/nodejs/node/pull/8643
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
2016-09-20 23:21:10 -04:00
Andreas Madsen
d3834a1fa3 benchmark: ignore significance when using --runs 1
Because the standard deviation can't be calculated when there is only
one observation the R scripts raises an error. However it may still be
useful to run them for non-statistical purposes.

This changes the behaviour such when there is only one observation, the
values that depends on the standard deviation becomes Not Applicable
(NA).

Fixes: https://github.com/nodejs/node/issues/8288
PR-URL: https://github.com/nodejs/node/pull/8299
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-16 20:58:27 +02:00
Rich Trott
d4061a6314 tools: replace custom ESLint rule with built-in
ESLint 3.5.0 introduces a `no-restricted-properties` rule. Replace our
custom `no-deepEqual` rule with this rule.

PR-URL: https://github.com/nodejs/node/pull/8478
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-12 21:12:03 -07:00
Anna Henningsen
450ee63584 benchmark: add benches for fs.stat & fs.statSync
Add very simple benchmarks for `fs.stat` and `fs.statSync` as
well as `fs.lstat` and `fs.lstatSync` based on the `readdir`
benchmarks.

PR-URL: https://github.com/nodejs/node/pull/8338
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-09-11 20:53:17 -07:00
Anna Henningsen
efabc6ae4d benchmark: fix off-by-one error in fs benchmarks
Fix a off-by-one error that made the benchmarks for asynchronous
functions run `n - 1` times instead of `n` times.

PR-URL: https://github.com/nodejs/node/pull/8338
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-09-11 20:52:57 -07:00
Bartosz Sosnowski
b1bbc68fb1 benchmark: support for multiple http benchmarkers
This adds support for multiple HTTP benchmarkers. Adds autocannon
as the secondary benchmarker.

PR-URL: https://github.com/nodejs/node/pull/8140
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-08-31 17:49:26 +02:00
Adrian Nitu
474e629ddb benchmark: add --format csv option
Added the option of using --format csv when outputting data.

Fixes: https://github.com/nodejs/node/issues/7890
PR-URL: https://github.com/nodejs/node/pull/7961
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2016-08-12 13:23:43 +02:00
Adrian Nitu
4b527a4129 benchmark: update compare.js exit method
Node documentation recommends using process.exitCode = x and returning
as a way to exit.

PR-URL: https://github.com/nodejs/node/pull/7961
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2016-08-12 13:23:43 +02:00
Adrian Nitu
9e7fd8e810 benchmark: fix comment typos and code format
I noticed some typos and the lack of {} following an if.

PR-URL: https://github.com/nodejs/node/pull/7961
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2016-08-12 13:23:06 +02:00
Trevor Norris
b9832eb3fe bench: add bench for fs.realpath() fix
The benchmarks included also work for the previous JS
implementation of fs.realpath(). In case the new implementation of
realpath() needs to be reverted, we want these changes to stick around.

PR-URL: https://github.com/nodejs/node/pull/7899
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-08-12 13:11:01 +02:00
Rich Trott
ae25ed3ccd benchmark: favor === over ==
Refs: https://github.com/nodejs/node/pull/7961#discussion_r73788501
PR-URL: https://github.com/nodejs/node/pull/8000
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-08-09 14:40:01 -07:00
Сковорода Никита Андреевич
f3f5a89a10 doc: *.md formatting fixes in the benchmark dir
* Add language specification for the txt code blocks.
* Move the definitions to the bottom.

Ref: https://github.com/nodejs/node/pull/7727

PR-URL: https://github.com/nodejs/node/pull/7727
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 11:11:56 +03:00
Andreas Madsen
d525e6c92a benchmark: remove broken string-creation.js
Strings where never mutable, it is not clear what this benchmarks
attempts to do. This did work at some point, but only because the
benchmark wasn't using strict mode.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:22:01 +02:00
Andreas Madsen
6edef1deb9 benchmark: update docs after refactor
PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:21:59 +02:00
Andreas Madsen
0c0f34e2fe benchmark: add script for creating scatter plot
Previously this a tool in `plot.R`. It is now are more complete tool
which executes the benchmarks many times and creates a boxplot.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:21:57 +02:00
Andreas Madsen
855009af7f benchmark: use t-test for comparing node versions
The data sampling is done in node and the data processing is done in R.
Only plyr was added as an R dependency and it is fairly standard.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:21:53 +02:00
Andreas Madsen
8bb59fdb12 benchmark: missing process.exit after bench.end
Previously bench.end would call process.exit(0) however this is rather
confusing and indeed a few benchmarks had code that assumed otherwise.

This adds process.exit(0) to the benchmarks that needs it.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:21:50 +02:00
Andreas Madsen
f99471b2ae benchmark: refactor to use process.send
This removes the need for parsing stdout from the benchmarks. If the
process wasn't executed by fork, it will just print like it used to.

This also fixes the parsing of CLI arguments, by inferring the type
from the options object instead of the value content.

Only two benchmarks had to be changed:

* http/http_server_for_chunky_client.js this previously used a spawn
now it uses a fork and relays the messages using common.sendResult.

* misc/v8-bench.js this utilized that v8/benchmark/run.js called
global.print and reformatted the input. It now interfaces directly
with the benchmark runner global.BenchmarkSuite.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:21:39 +02:00
Andreas Madsen
0f9bfaa7c5 benchmark: move cli parts of common.js into run.js
It wasn't obviouse that common.js was the main cli tool.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 12:48:46 +02:00
Andreas Madsen
edbed3f3fd benchmark: move http_simple.js to http directory
PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 12:48:23 +02:00
Andreas Madsen
ee2843b4ea benchmark: remove unused files
These files are very old and undocumented. Most likely nobody are
using them.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 12:42:40 +02:00
Christopher Jeffrey
151d316b99
buffer: optimize hex_decode
PR-URL: https://github.com/nodejs/node/pull/7602
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-17 18:21:33 +02:00
Rich Trott
5b63d48e9e lib,benchmark,test: implement consistent braces
This change is in preparation for lint-enforced brace style.

PR-URL: https://github.com/nodejs/node/pull/7630
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-07-12 10:33:29 -07:00
Rich Trott
ce9456d690 benchmark: remove unused variables
Remove variables that are assigned but never used.

(This was missed by the linter in previous versions of ESLint but is
flagged by the current version. Updating the linter is contingent on
this change or some similar remedy landing.)

PR-URL: https://github.com/nodejs/node/pull/7600
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-07-10 20:13:14 -07:00
James M Snell
7de59ef925 net: use icu's punycode implementation
ICU has a punycode implementation built in. Use it instead of the
javascript implementation because it's much faster.

PR-URL: https://github.com/nodejs/node/pull/7355
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-29 17:10:53 -07:00
Andras
fba271b379 benchmark: add setImmediate() benchmarks
Timings for sequential and concurren setImmediate() with and without
arguments, and set + clearImmediate().

PR-URL: https://github.com/nodejs/node/pull/6436
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-06-29 11:02:26 +02:00
Zach Bjornson
a1059afd39 buffer: speed up swap16/32, add swap64
* Speed up buffer.swap16 and swap32 by using builtins. Up to ~6x gain.
  Drop transition point between JS and C++ implementations accordingly.
  Amount of performance improvement not only depends on buffer size but
  also memory alignment.
* Fix tests: C++ impl tests were testing 0-filled buffers so were
  always passing.
* Add similar buffer.swap64 method.
* Make buffer-swap benchmark mirror JS impl.

doc/api/buffer.markdown has an entry of "added: REPLACEME" that should
be changed to the correct release number before tagged.

Because node is currently using a very old version of cpplint.py it
doesn't know that std::swap() has moved from <algorithm> to <utility> in
c++11. So until cpplint.py is updated simply NOLINT the line.
Technically it should be NOLINT(build/include_what_you_use), but that
puts the line over 80 characters causing another lint error.

PR-URL: https://github.com/nodejs/node/pull/7157
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-06-27 14:38:37 -06:00
surya panikkal
6abb06f821 benchmark: util._extend vs object.assign
To copy the values of all enumerable own properties from-
a source object to a target object, node still use-
`util._extend`, though newer standard `Object.assign`
is available. This is because `util._extend` is found to
be faster than `Object.assign`. This benchmark test is
to keep track of how performance compare.

PR-URL: https://github.com/nodejs/node/pull/7255
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-06-27 08:32:08 -07:00
James M Snell
f3d5efa3ee tls: avoid calling Buffer.byteLength multiple times
There's no reason to be calling Buffer.byteLength() twice.
Small perf improvement

Run 1:
tls/convertprotocols.js n=1     v6.2.1 = 11852,  new = 12204 ......  -2.89%
tls/convertprotocols.js n=50000 v6.2.1 = 515660, new = 570610 .....  -9.63%

Run 2:
tls/convertprotocols.js n=1     v6.2.1 = 11729,  new = 12045 ......  -2.62%
tls/convertprotocols.js n=50000 v6.2.1 = 512080, new = 637730 ..... -19.70%

PR-URL: https://github.com/nodejs/node/pull/7236
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-06-21 10:53:25 -07:00
James M Snell
6be73feaeb crypto,tls: perf improvements for crypto and tls getCiphers
Improve performance of crypto.getCiphers, getHashes, getCurves
and tls.getCiphers by consolidating filterDuplicates logic, adding
caching of output, and streamlining filterDuplicates implementation.

Benchmarks:

crypto.getCiphers n=1    v6.2.1 = 2559.3, new = 15890 ...... -83.89%
crypto.getCiphers n=5000 v6.2.1 = 3516.3, new = 24203000 ... -99.99%

tls.getCiphers    n=1    v6.2.1 = 3405.3, new = 14877 ...... -77.11%
tls.getCiphers    n=5000 v6.2.1 = 6074.4, new = 24202000 ... -99.97%

PR-URL: https://github.com/nodejs/node/pull/7225
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-06-21 10:03:08 -07:00
Brian White
686984696d
stream: improve Readable.read() performance
read() performance is improved most by switching from an array to
a linked list for storing buffered data. However, other changes that
also contribute include: making some hot functions inlinable, faster
read() argument checking, and misc code rearrangement to avoid
unnecessary code execution.

PR-URL: https://github.com/nodejs/node/pull/7077
Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-06-14 15:15:34 -04:00
Brian White
c570182a39
benchmark: don't convert arguments to numbers
PR-URL: https://github.com/nodejs/node/pull/6570
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-14 15:13:00 -04:00
Brian White
39fdf0773d
benchmark: increase http token check iterations
PR-URL: https://github.com/nodejs/node/pull/6570
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-14 15:13:00 -04:00
Brian White
83432bfff1
http: optimize checkInvalidHeaderChar()
This commit optimizes checkInvalidHeaderChar() by unrolling the
character checking loop a bit.

Additionally, some changes to the benchmark runner are needed in
order for the included benchmark to be run correctly. Specifically,
the regexp used to parse `key=value` parameters contained a greedy
quantifier that was causing the `key` to match part of the `value`
if `value` contained an equals sign.

PR-URL: https://github.com/nodejs/node/pull/6570
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-06-14 15:13:00 -04:00
Rich Trott
08ea9ee56d benchmark: add benchmark for url.format()
PR-URL: https://github.com/nodejs/node/pull/7250
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-06-13 16:17:22 -07:00
Bartosz Sosnowski
5386b23f64 benchmark: fix child-process-exec-stdout on win
This benchmark fails on Windows when trying to execute command which
is more than 32k in size. This commits skips this one case when running
under Windows.

PR-URL: https://github.com/nodejs/node/pull/7178
Reviewed-By: Trott - Rich Trott <rtrott@gmail.com>
Reviewed-By: orangemocha - Alexis Campailla <orangemocha@nodejs.org>
2016-06-10 17:30:28 +02:00
Bartosz Sosnowski
cbbdc298b0 benchmark: fix child-process-read on Windows
Under Windows 'ipc' communication requires the other process to format
its messages with 'IPC framing protocol'. Otherwise, an assert is
triggered in libuv. This commit changes child-process-read benchmark
to use stdout to communicate with parent process. It also adds
child-process-read-ipc.js to benchmark IPC communication using
child node process.

PR-URL: https://github.com/nodejs/node/pull/6971
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-06-09 12:42:54 +01:00
Anna Henningsen
abd0d68bea
benchmark: add benchmark for Buffer.concat
PR-URL: https://github.com/nodejs/node/pull/7054
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-06-05 13:56:34 +02:00
Brian White
d23b7d2656
string_decoder: rewrite implementation
This commit provides a rewrite of StringDecoder that both improves
performance (for non-single-byte encodings) and understandability.

Additionally, StringDecoder instantiation performance has increased
considerably due to inlinability and more efficient encoding name
checking.

PR-URL: https://github.com/nodejs/node/pull/6777
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-05-29 14:48:11 -04:00
Ingvar Stepanyan
4a56e89d20
buffer: fix dataview-set benchmark
Improves numbers up to 4x by avoiding repetitive dynamic method lookup.

PR-URL: https://github.com/nodejs/node/pull/6922
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-05-28 06:30:38 +02:00
Rich Trott
c9a5990a76 child_process: measure buffer length in bytes
This change fixes a known issue where `maxBuffer` limits by characters
rather than bytes. Benchmark added to confirm no performance regression
occurs with this change.

PR-URL: https://github.com/nodejs/node/pull/6764
Fixes: https://github.com/nodejs/node/issues/1901
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-05-25 10:57:59 -07:00
Rich Trott
a56da51a38 benchmark,test,lib: remove extra spaces
In preparation for stricter linting, remove extra spaces.

PR-URL: https://github.com/nodejs/node/pull/6645
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-05-11 23:18:16 -07:00
James M Snell
ba6196f843 util: fix inspecting of proxy objects
In certain conditions, inspecting a Proxy object can lead to a
max call stack error. Avoid that by detecting the Proxy object
and outputting information about the Proxy object itself.

Fixes: https://github.com/nodejs/node/issues/6464
PR-URL: https://github.com/nodejs/node/pull/6465
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-05-03 10:08:24 -07:00
Matt Loring
89164a096d benchmark: Fix crash in net benchmarks
Net benchmarks create partial event emitters that do not have all of the
required event emitter functions. They currently mock out `on`, `once`,
and `emit` functions. This change mocks out `prependListener` as well to
avoid crashing in `_stream_readable`.

PR-URL: https://www.github.com/nodejs/node/pull/6407
Fixes: https://www.github.com/nodejs/node/issues/6405
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-27 17:06:08 -07:00
Rich Trott
a7335bd1f0 test,benchmark: use deepStrictEqual()
In preparation for a lint rule that will enforce
assert.deepStrictEqual() over assert.deepEqual(), change tests and
benchmarks accordingly. For tests and benchmarks that are testing or
benchmarking assert.deepEqual() itself, apply a comment to ignore the
upcoming rule.

PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-22 14:38:09 -07:00
Myles Borins
cff2a137f2 benchmarks: fix lint error
33c242e7e9 introduced a linting error with indentation

PR-URL: https://github.com/nodejs/node/pull/6314
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-20 15:54:50 -07:00
James M Snell
7dc1a87a7b benchmarks: add microbenchmarks for new ES6 features
Adds new microbenchmarks for destructuring, rest params and
default params.

PR-URL: https://github.com/nodejs/node/pull/6222
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 14:57:51 -07:00
James M Snell
cb9eff2f93 benchmarks: add common.v8ForceOptimization
It's useful to be able to force optimization of a function.
Rather than duplicating the code everywhere for it, let's
make a utility available.

PR-URL: https://github.com/nodejs/node/pull/6222
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 14:57:46 -07:00
James M Snell
33c242e7e9 console: refactor to use rest params and template strings
Overall cleanup in code, eliminate reliance on `arguments`.

Benchmarks show that as of v8 5.0.71.32, using rest params + apply
has good performance. The spread operator is not yet well optimized
in v8

```
misc/console.js method=restAndSpread concat=1 n=1000000: 374779.38359
misc/console.js method=restAndSpread concat=0 n=1000000: 375988.30434
misc/console.js method=argumentsAndApply concat=1 n=1000000: 682618.61125
misc/console.js method=argumentsAndApply concat=0 n=1000000: 645093.74443
misc/console.js method=restAndApply concat=1 n=1000000: 682931.41217
misc/console.js method=restAndApply concat=0 n=1000000: 664473.09700
```

PR-URL: https://github.com/nodejs/node/pull/6233
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-20 14:45:42 -07:00
James M Snell
627524973a buffer: add Buffer.allocUnsafeSlow(size)
Aligns the functionality of SlowBuffer with the new Buffer
constructor API. Next step is to docs-only deprecate
SlowBuffer.

Replace the internal uses of SlowBuffer with
`Buffer.allocUnsafeSlow(size)`

PR-URL: https://github.com/nodejs/node/pull/5833
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-04-15 10:36:01 -07:00
Brian White
1e4674ae0a
benchmark: add module loader benchmark parameter
PR-URL: https://github.com/nodejs/node/pull/5172
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-14 14:56:27 -04:00
James M Snell
a2466896dd buffer: add Buffer.prototype.compare by offset
Adds additional `targetStart`, `targetEnd`, `sourceStart,
and `sourceEnd` arguments to `Buffer.prototype.compare`
to allow comparison of sub-ranges of two Buffers without
requiring Buffer.prototype.slice()

Fixes: https://github.com/nodejs/node/issues/521
PR-URL: https://github.com/nodejs/node/pull/5880
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-04-08 20:16:46 -07:00
Jackson Tian
089c6a4fba http: speed up checkIsHttpToken
The Regex implementation is not faster than ascii code compare.

the field name is shorter, the speed is faster.

benchmark result here:

https://bitbucket.org/snippets/JacksonTian/Rnbad/benchmark-result

PR-URL: https://github.com/nodejs/node/pull/4790
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-27 13:58:26 -07:00
Jackson Tian
afd821a91d buffer: faster case for create buffer from empty string
When create Buffer from empty string will touch
C++ binding also.

This patch can improve edge case ~70% faster.

PR-URL: https://github.com/nodejs/node/pull/4414
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-27 09:14:48 -07:00
James M Snell
7d73e60f60 buffer: add swap16() and swap32() methods
Adds Buffer.prototype.swap16() and Buffer.prototype.swap32()
methods that mutate the Buffer instance in-place by swapping the
16-bit and 32-bit byte-order.

Example:

```js
const buf = Buffer([0x1, 0x2, 0x3, 0x4]);
buf.swap16();
console.log(buf);
  // prints Buffer(0x2, 0x1, 0x4, 0x3);

buf.swap32();
console.log(buf);
  // prints Buffer(0x3, 0x4, 0x1, 0x2);
```

PR-URL: https://github.com/nodejs/node/pull/5724
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-03-23 08:52:44 -07:00
Rich Trott
cde81b6b9f benchmark: fix linting errors
4d78121b77 had lint errors that went
undetected. This fixes them.

PR-URL: https://github.com/nodejs/node/pull/5840
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 20:55:33 -07:00
Jackson Tian
4d78121b77 lib: simplify code with String.prototype.repeat()
use String.prototype.repeat() to simplify code, less code,
more semantically.

PR-URL: https://github.com/nodejs/node/pull/5359
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 16:42:58 -07:00
Brian White
089bef0a81 timers: improve setImmediate() performance
This commit improves setImmediate() performance by moving the
try-finally block that wraps callback execution into a separate
function because currently v8 never tries to optimize functions
that contain try-finally blocks.

With this change, there is a ~20-40% improvement in the included
setImmediate() depth benchmarks. The breadth benchmarks show a slight
improvement.

PR-URL: https://github.com/nodejs/node/pull/4169
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-03-18 19:25:51 -04:00
James M Snell
85ab4a5f12 buffer: add .from(), .alloc() and .allocUnsafe()
Several changes:

* Soft-Deprecate Buffer() constructors
* Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
* Add `--zero-fill-buffers` command line option
* Add byteOffset and length to `new Buffer(arrayBuffer)` constructor
* buffer.fill('') previously had no effect, now zero-fills
* Update the docs

PR-URL: https://github.com/nodejs/node/pull/4682
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-03-16 08:34:02 -07:00
Rich Trott
810aa9f6c3 tools: enable no-self-assign ESLint rule
Enabled no-self-assign rule in ESLint.

This required one change in a benchmark file. Changed a loop (that is
outside of the benchmark itself, so performance is not critical) from a
for loop that repeats a string to use String.prototype.repeat() instead.

While at it, took the opportunity to const-ify the benchmark file.

Also moved the "Strict" section in the .eslintrc to match where it is in
the ESLint documentation. Updated the link for Strict rules to point to
the ESLint website rather than the GitHub-hosted code.

PR-URL: https://github.com/nodejs/node/pull/5552
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-03-07 10:07:17 -08:00
Evan Lucas
735e0df8e4 benchmark: add util.format benchmark
PR-URL: https://github.com/nodejs/node/pull/5360
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-04 17:27:10 -06:00
Rich Trott
1bedeeb41d benchmark: fix lint errors
PR-URL: https://github.com/nodejs/node/pull/5517
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-03 09:53:22 -08:00
Anton Khlynovskiy
c647e87504 lib: freelist: use .pop() for allocation
Array#pop() is known to be faster than Array#shift().
To be exact, it's O(1) vs. O(n). In this case there's no difference
from which side of the "pool" array the object is retrieved,
so .pop() should be preferred.

PR-URL: https://github.com/nodejs/node/pull/2174
Reviewed-By: mscdex - Brian White <mscdex@mscdex.net>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
2016-03-02 09:24:24 -08:00
Rich Trott
76e4a74377 benchmark: refactor to eliminate redeclared vars
In order to comply with linting rules used in the rest of the code base,
eliminate redeclared variables. A conservative approach is used so as to
avoid unintentional performance issues (for example, as might be seen in
some situations when using `let` instead of `var`).

PR-URL: https://github.com/nodejs/node/pull/5468
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-01 13:48:42 -08:00
Rich Trott
ffdc046e5c benchmark: add benchmark for buf.compare()
There is a benchmark for the class method `Buffer.compare()` but not for
the instance method `buf.compare()`. This adds that benchmark.

I used this to confirm a performance regression in an implementation I
was considering. While the implementation was a bust, it does seem like
the benchmark is worthwhile.

The benchmark is nearly identical to the existing `Buffer.compare()`
benchmark except, of course, that it calls `buf.compare()` instead.

PR-URL: https://github.com/nodejs/node/pull/5441
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-02-27 20:17:56 -08:00
Rich Trott
dcfda1007b tools,benchmark: increase lint compliance
In the hopes of soon having the benchmark code linted, this change
groups all the likely non-controversial lint-compliance changes such as
indentation, semi-colon usage, and single-vs.-double quotation marks.

Other lint rules may have subtle performance implications in the V8
currently shipped with Node.js. Those changes will require more careful
review and will be in a separate change.

PR-URL: https://github.com/nodejs/node/pull/5429
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-02-27 20:15:17 -08:00
Andreas Madsen
2426b3dd86 benchmark: move string-decoder to its own category
PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:20 +11:00
Andreas Madsen
15720fa25a benchmark: fix configuation parameters
The benchmark runner spawns new processes for each configuration. The
specific configuration is transfered by process.argv. This means that
the values have to be parsed. As of right now only numbers and strings
are parsed correctly. However other values such as objects where used.

This fixes the benchmarks that used non-string/number values and
prevents future issues by asserting the type.

PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:10 +11:00
Andreas Madsen
f6c505d0b1 benchmark: merge url.js with url-resolve.js
url.js was broken since it didn't use the common.js runner. This fixes
that issue by merging it with url-resolve.js, which also benchmarks
url.resolve.

PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:05 +11:00
Andreas Madsen
d9079ab801 benchmark: move misc to categorized directories
PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:28:45 +11:00
Rich Trott
4bb529d972 benchmark: use strict mode
Apply strict mode to benchmark code.

PR-URL: https://github.com/nodejs/node/pull/5336
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-22 11:09:26 -08:00
Brian White
00638ac160 querystring: improve escape() performance
This commit improves escape() performance by up to 15% with the
existing querystring-stringify benchmarks by reducing the number
of string concatentations. A potential deopt is also avoided by
making sure the index passed to charCodeAt() is within bounds.

PR-URL: https://github.com/nodejs/node/pull/5012
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-02-12 20:00:22 -05:00
Brian White
a2a69a2b63 querystring: improve parse() performance
This commit improves parse() performance by ~20-200% with the various
querystring-parse benchmarks.

Some optimization strategies used in this commit include:
* Combining multiple searches (for '&', '=', and '+') on the same
   string into a single loop
* Avoiding string.split()
* Minimizing creation of temporary strings
* Avoiding string decoding if no encoded bytes were found and the
   default string decoder is being used

PR-URL: https://github.com/nodejs/node/pull/5012
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-02-12 19:59:49 -05:00
Brian White
e1348b0819 benchmark: split path benchmarks
This commit splits each path benchmark into separate posix and
Windows benchmark files. This allows benchmarking (platform-)specific
inputs against specific platforms (only).

PR-URL: https://github.com/nodejs/node/pull/5123
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 20:35:35 -08:00
Brian White
72d0f88215 benchmark: allow empty parameters
PR-URL: https://github.com/nodejs/node/pull/5123
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 20:35:19 -08:00
Matteo Collina
7764b6cb96 streams: 5% throughput gain when sending small chunks
Improves the performance when moving small buffers by 5%,
and it adds a benchmark to avoid regression in that area.
In all other cases it is equally performant to current master.

Full performance results available at:
https://gist.github.com/mcollina/717c35ad07d15710b6b9.

PR-URL: https://github.com/nodejs/node/pull/4354
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 09:30:12 +00:00
Matteo Collina
137f53c7b7 dgram: support dgram.send with multiple buffers
Added ability to dgram.send to send multiple buffers, _writev style.
The offset and length parameters in dgram.send are now optional.
Refactored the dgram benchmarks, and seperated them from net.
Added docs for the new signature.

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fixes: https://github.com/nodejs/node/issues/4302
PR-URL: https://github.com/nodejs/node/pull/4374
2016-01-29 19:26:44 +01:00
Minwoo Jung
4126441013 benchmark: add a constant declaration for net
Constant declaration for `net` is omitted in `idle_server.js`
Add a constant declaration for constant `net`

PR-URL: https://github.com/nodejs/node/pull/3950
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-29 20:40:35 +09:00
Brian White
4bc1a47761 querystring: improve parse() performance
These changes improve parse() performance from ~11-30% on all of
the existing querystring benchmarks.

PR-URL: https://github.com/nodejs/node/pull/4675
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-14 18:02:52 -08:00
Jackson Tian
3e740caaf3 util: faster arrayToHash
The `util.format()` is used frequently, make the method faster
is better.

R-URL: https://github.com/nodejs/node/pull/3964
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-30 11:54:26 -08:00
Jackson Tian
5396baf7c1 buffer: faster case for create Buffer from new Buffer(0)
When create Buffer from a Buffer will copy data
from old to new even though length is zero.

This patch can improve edge case 4x faster.
following is benchmark results.

new: buffers/buffer_zero.js n=1024: 2463.53891
old: buffers/buffer_zero.js n=1024: 618.70801

PR-URL: https://github.com/nodejs/node/pull/4326
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-23 17:15:19 -08:00
Claudio Rodriguez
63786227cc assert: typed array deepequal performance fix
assert.deepEqual: when actual and expected are typed arrays,
wrap them in a new Buffer each to increase performance
significantly.

PR-URL: https://github.com/nodejs/node/pull/4330
Fixes: https://github.com/nodejs/node/issues/4294
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-21 18:04:01 +01:00
Trevor Norris
56985ca258 node: improve accessor perf of process.env
Set process.env array entries in JS.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:29:31 -07:00
Trevor Norris
36e8a2c63d node: improve performance of hrtime()
process.hrtime() was performing too many operations in C++ that could be
done faster in JS. Move those operations over by creating a length 4
Uint32Array and perform bitwise operations on the seconds so that it was
unnecessary for the native API to do any object creation or set any
fields.

This has improved performance from ~350 ns/op to ~65 ns/op. Light
benchmark included to demonstrate the performance change.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:29:16 -07:00
Trevor Norris
0fde28ce37 fs: use pushValueToArray for readdir(Sync)
Improve performance by pushing directory entries to returned array in
batches of 8 using pushValueToArray() in JS. Add benchmarks to
demonstrate this improvement.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:29:06 -07:00
Trevor Norris
d39ace16ba http_parser: use pushValueToArray for headers
For performance add headers to the headers Array by pushing them on from
JS. Benchmark added to demonstrate this case.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:28:53 -07:00
Myles Borins
b619831381 meta: remove use of profanity in source
The CoC requests to avoid the casual use of profanity.

PR-URL: https://github.com/nodejs/node/pull/4122
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2015-12-02 11:05:11 -08:00
Karl Skomski
a18dd7b788 src: replace naive search in Buffer::IndexOf
Adds the string search implementation from v8
which uses naive search if pattern length < 8
or to a specific badness then uses Boyer-Moore-Horspool

Added benchmark shows the expected improvements
Added option to use ucs2 encoding with Buffer::IndexOf

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2539
2015-10-07 21:09:53 -07:00
Minwoo Jung
f1d27d27f5 benchmark: update comment in common.js
Very minor update in benchmark/common.js
Not exactly a critical change, just continued cleaning
out of old joyent/node PRs that never landed.

Ref: https://github.com/nodejs/node-v0.x-archive/pull/8515
PR-URL: https://github.com/nodejs/node/pull/2399
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2015-09-29 16:00:04 -07:00
Dmitry Vasilyev
942da888b5 doc: rename from iojs(1) to node(1) in benchmarks
Examples in the benchmark readme previously sill referenced iojs(1).

PR-URL: https://github.com/nodejs/node/pull/2884
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-09-15 14:02:02 -04:00
Michaël Zasso
4abc896a82 src: replace usage of v8::Handle with v8::Local
v8::Handle is deprecated: https://codereview.chromium.org/1224623004

PR-URL: https://github.com/nodejs/io.js/pull/2202
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-06 21:38:05 +10:00
cjihrig
a69ab27ab4 node: rename from io.js to node
This commit replaces instances of io.js with Node.js, based on the
recent convergence. There are some remaining instances of io.js,
related to build and the installer.

Fixes: https://github.com/nodejs/node/issues/2361
PR-URL: https://github.com/nodejs/node/pull/2367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2015-08-23 17:59:43 -04:00
Sakthipriyan Vairamani
8f58fb92ff events: deprecate static listenerCount function
As per the discussion in #734, this patch deprecates the usage of
`EventEmitter.listenerCount` static function in the docs, and introduces
the `listenerCount` function in the prototype of `EventEmitter` itself.

PR-URL: https://github.com/nodejs/node/pull/2349
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2015-08-20 03:17:08 +05:30
Nathan Woltman
99d9d7e716 benchmark: add remaining path benchmarks & optimize
As a follow-up to 0d15161, this commit adds benchmarks for the rest
of the path functions and also forces V8 to optimize the functions
before starting the benchmark test.

PR-URL: https://github.com/nodejs/io.js/pull/2103
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-07-26 22:17:41 -07:00
Ben Noordhuis
8fd3ce100e src: make base64 decoding 50% faster
Make the inner loop execute fewer compare-and-branch executions per
processed byte, resulting in a 50% or more speedup.

This coincidentally fixes an out-of-bounds read:

    while (unbase64(*src) < 0 && src < srcEnd)

Should have read:

    while (src < srcEnd && unbase64(*src) < 0)

But this commit removes the offending code altogether.

Fixes: https://github.com/nodejs/io.js/issues/2166
PR-URL: https://github.com/nodejs/io.js/pull/2193
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-07-25 19:07:23 +02:00
Nathan Woltman
0d15161c24 benchmark: Add some path benchmarks for #1778
Path functions being benchmarked are:
* format
* isAbsolute
* join
* normalize
* relative
* resolve

PR-URL: https://github.com/nodejs/io.js/pull/1778
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-04 13:30:20 +02:00
Rich Trott
05a73c0f25 benchmark: make concurrent requests configurable
In http_bench.js, allow the concurrent requests per client
to be configurable.

This also changes the launch of clients to wait until all
forked servers are online. This eliminates spurious error
messages at the start of the run.

PR-URL: https://github.com/nodejs/io.js/pull/2068
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-29 23:01:53 -07:00
Rich Trott
f52d73352e benchmark: fix typo in README
PR-URL: https://github.com/nodejs/io.js/pull/2067
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-06-29 10:11:52 -07:00
Ben Noordhuis
8350f3a3a2 buffer: optimize Buffer#toString()
Break up Buffer#toString() into a fast and slow path.  The fast path
optimizes for zero-length buffers and no-arg method invocation.

The speedup for zero-length buffers is a satisfying 700%.  The no-arg
toString() operation gets faster by about 13% for a one-byte buffer.

This change exploits the fact that most Buffer#toString() calls are
plain no-arg method calls.  Rewriting the method to take no arguments
means a call doesn't go through an ArgumentsAdaptorTrampoline stack
frame in the common case.

PR-URL: https://github.com/nodejs/io.js/pull/2027
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Daniel Cousens <email@dcousens.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-25 18:32:15 +02:00
Jeremiah Senkpiel
dbd5dc932d doc: clarify prerequisites in benchmark/README.md
PR-URL: https://github.com/nodejs/io.js/pull/2034
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-24 09:57:22 -07:00
Rich Trott
5c2707c1b2 doc: benchmark/README.md copyedit
PR-URL: https://github.com/nodejs/io.js/pull/1970
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-06-15 08:44:11 -07:00
Brendan Ashworth
9da168b71f buffer: optimize Buffer.byteLength
Buffer.byteLength is important for speed because it is called whenever a
new Buffer is created from a string.

This commit optimizes Buffer.byteLength execution by:
- moving base64 length calculation into JS-land, which is now much
  faster
- remove redundant code and streamline the UTF8 length calculation

It also adds a benchmark and better tests.

PR-URL: https://github.com/nodejs/io.js/pull/1713
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-22 15:31:03 -07:00
Brian White
c7782c0af8 node: improve nextTick performance
This commit uses separate functions to isolate deopts caused by
try-catches and avoids fn.apply() for callbacks with small numbers
of arguments.

These changes improve performance by ~1-40% in the various
nextTick benchmarks.

PR-URL: https://github.com/iojs/io.js/pull/1571
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-01 21:27:34 -04:00
Jackson Tian
d2b62a4973 benchmark: don't check wrk in non-http benchmark
When running a non-http benchmark, there is no need the check for the
wrk tool so move the wrk check into the http method.

PR-URL: https://github.com/iojs/io.js/pull/1368
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-04-09 12:09:09 +02:00
Shigeki Ohtsu
3a69b7689b benchmark: add rsa/aes-gcm performance test
PR-URL: https://github.com/iojs/io.js/pull/1325
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-04 12:37:26 +09:00
Shigeki Ohtsu
1c709f3aa9 benchmark: add/remove hash algorithm
add sha1, sha512 algorithm and remove md5

PR-URL: https://github.com/iojs/io.js/pull/1325
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-04 12:37:26 +09:00
Brian White
a081c7c522 benchmark: fix chunky client benchmark execution
This commit fixes a few things for this benchmark:

1. Ensures the temporary directory for the unix socket exists.
2. Prevents the client code from being run directly because the
server script is the one that calls out the client code.
3. Ensures the server is closed once the client benchmarks have
finished.
4. Since this is an http benchmark, it should be moved to the http
benchmarks subdirectory.

PR-URL: https://github.com/iojs/io.js/pull/1257
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-04-03 00:56:45 -04:00
Brian White
8a945814dd string_decoder: optimize write()
By limiting property getting/setting to only where they are
absolutely necessary, we can achieve greater performance
especially with small utf8 inputs and any size base64 inputs.

PR-URL: https://github.com/iojs/io.js/pull/1209
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-03-25 00:34:34 -04:00
Brendan Ashworth
c638dad567 benchmark: add output format option [csv]
This commit adds an `OUTPUT_FORMAT` environment variable option for
all benchmark tests that allow either 'csv' or 'default' output. Default
output has been left unchanged, and csv output prints out the csv
headers along with the csv formatted per-test output, each test also
seperated by a newline.

It can be used like the following:
$ OUTPUT_FORMAT=csv iojs benchmark/common.js http

Not specifying the OUTPUT_FORMAT env var will default to 'default'.
Specifying a bad value will throw an error.

PR-URL: https://github.com/iojs/io.js/pull/777
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-03-16 21:27:17 -07:00
Brendan Ashworth
97d8d4928d benchmark: add plot_csv R graphing script
This commit adds a graphing script (in R) for graphing the CSV output
of a benchmark. It can be run like this:

```
$ OUTPUT_FORMAT=csv iojs benchmark/http/client-request-body.js >
data.csv
$ ./benchmark/plot_csv.R data.csv graph.png bytes type
```

This will graph the output to `graph.png`, using the output's `bytes`
value as X and the result value for each as Y. Output will be grouped
by `type`.

Running as the example yields a beautiful graph like this:
http://pbrd.co/1vBhUfy.

PR-URL: https://github.com/iojs/io.js/pull/777
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-03-16 21:26:05 -07:00
Rudi Cilibrasi
030a92347d benchmark: chunky http client benchmark variation
PR-URL: https://github.com/iojs/io.js/pull/228
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-03-09 10:58:40 -06:00
Brian White
b27931b0fe benchmark: fix wrk check
PR-URL: https://github.com/iojs/io.js/pull/1076
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-03-05 17:13:08 -05:00
Johan Bergström
2b79052494 benchmark: check for wrk ahead of running benchmarks
PR-URL: https://github.com/iojs/io.js/pull/982
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-03-04 20:25:49 -08:00
Johan Bergström
a45d4f8fd6 build: remove tools/wrk from the tree
wrk is an optional tool that some of the http benchmarks uses. The removal
doesn't affect any users. Developers are assumed to install it before running
the tests.

This change reduces the tarball by 5%

PR-URL: https://github.com/iojs/io.js/pull/982
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-03-04 20:25:41 -08:00
Petka Antonov
8a1e22af3a benchmark: pass execArgv to the benchmarking process
Benchmarker should pass exec flags (e.g. --no-crankshaft,
--turbofan-filter, --trace-opt etc) to the benchmarking process

Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
PR-URL: https://github.com/iojs/io.js/pull/928
2015-02-24 15:55:12 -08:00
Brian White
35ed79932c benchmark: add a few querystring benchmarks
PR-URL: https://github.com/iojs/io.js/pull/847
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-02-14 23:41:52 -08:00
Ben Noordhuis
2c3121c606 benchmark: bump eventemitter number of iterations
Some of the benchmarks that were added in commit 847b9d2 complete too
quickly to draw meaningful conclusions from.  Increase the number of
iterations to make them run longer.

PR-URL: https://github.com/iojs/io.js/pull/746
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-02-07 00:54:38 +02:00
Brian White
847b9d212a benchmark: add more EventEmitter benchmarks
PR-URL: https://github.com/iojs/io.js/pull/730
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-02-06 21:33:44 +01:00
Brian White
e0730eeaa5 benchmark: allow compare via fine-grained filters
Before this commit, only benchmark targets defined in Makefile could
be used. This commit allows execution of common.js directly and
passing of filter arguments directly, allowing you to run either a
subset of benchmarks or a single specific benchmark for comparison.

PR-URL: https://github.com/iojs/io.js/pull/711
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-02-04 16:55:18 -05:00
Evan Lucas
3e675e44b5 benchmark: don't use template strings
When running benchmark/compare.js, it is typical to run a version of
node that does not support template strings. This provides backwards
compatibility for comparing benchmarks using older versions of node.

PR-URL: https://github.com/iojs/io.js/pull/714
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-02-04 03:53:22 -06:00
Brendan Ashworth
89dd8e062f benchmark: clean up common.js
This commit cleans up `benchmark/common.js` with a few generic changes
such as the following:

- declare all `require()`'d libraries at the top instead of in the
  middle
- add some empty whitespace where it helps readability
- changes ambiguous variable names
- standardizes most if / else blocks
- missing semicolons

PR-URL: https://github.com/iojs/io.js/pull/662
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2015-02-02 14:43:16 -08:00
Brendan Ashworth
083c421b5c benchmark: remove extra spacing in http options
This commit removes the benchmark spacing modification in
`client-request-body.js` and `end-vs-write-end.js` which adds two spaces
to the end of some variables to make sure the lines line up.

The reason behind this is that its totally pointless (the lines don't
actually line up with it) and it disallows you to parse the output with
a tool like awk, or at least makes it a lot harder.

PR-URL: https://github.com/iojs/io.js/pull/650
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-01-30 16:09:10 -05:00
Fishrock123
514b1d964b doc: add more info to benchmark/README.md
Adds info on the `wrk` prerequisite for http benchmarks and how to
run benchmarks with options.

PR-URL: https://github.com/iojs/io.js/pull/629
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-01-28 16:56:26 -05:00
Vladimir Kurchatkin
45d8d9f826 buffer: implement iterable interface
This makes possible to use `for..of` loop with
buffers. Also related `keys`, `values` and `entries`
methods are added for feature parity with `Uint8Array`.

PR-URL: https://github.com/iojs/io.js/pull/525
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-28 16:40:15 +03:00
Yosuke Furukawa
5d014637b6 benchmark: print score to five decimal places
PR-URL: https://github.com/iojs/io.js/pull/516
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-21 01:21:44 +01:00
Yosuke Furukawa
3abfb56f9b benchmark: fix tcp bench after internal api change
Fix up the tcp raw benchmarks after an internal API change.

PR-URL: https://github.com/iojs/io.js/pull/495
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-18 18:09:10 +01:00
Ben Noordhuis
50177fb13c benchmark: stop v8 benchmark clobbering RegExp
deps/v8/benchmarks/regexp.js clobbers the RegExp global, breaking
util.format() and console.log().  Unclobber it to keep the other
benchmarks working.

Fixes the following error when running benchmark/misc/v8-bench.js:

    $ out/Release/iojs benchmark/misc/v8-bench.js
    util.js:84
        if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
            ^
    TypeError: object is not a function
        at Object.exports.debuglog (util.js:84:9)
        at timers.js:12:29
        at NativeModule.compile (node.js:800:5)
        at NativeModule.require (node.js:769:18)
        at net.js:5:14
        at NativeModule.compile (node.js:800:5)
        at NativeModule.require (node.js:769:18)
        at tty.js:4:11
        at NativeModule.compile (node.js:800:5)
        at Function.NativeModule.require (node.js:769:18)

This could alternatively be addressed by caching the RegExp global
in lib/util.js.  That's not a bad approach and I considered it but
doing it for just RegExp and not other globals would be half-baked.

Maybe the more thorough approach where we cache all globals at
start-up is something for a follow-up pull request.

Fixes: https://github.com/iojs/io.js/pull/475
PR-URL: https://github.com/iojs/io.js/pull/489
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
2015-01-18 14:08:29 +01:00
Yosuke Furukawa
ea7750bddd benchmark: add filter option for benchmark
Before:

    # common.js executes all tests in net directory.
    $ ./iojs common.js net

After:

    # common.js executes only "dgram" tests in net directory.
    $ ./iojs common.js net dgram

PR-URL: https://github.com/iojs/io.js/pull/488
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-17 17:13:07 +01:00
Yosuke Furukawa
182c3b689c benchmark: fix command name in benchmark scripts
PR-URL: https://github.com/iojs/io.js/pull/410
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-14 02:29:59 +01:00
isaacs
3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Ben Noordhuis
aff56cd2b4 lib: micro-optimize url.resolve()
Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.

Add a new benchmark to prove it.  With the change applied, it scores
about 5% higher and that is nothing to sneeze at.

PR-URL: https://github.com/iojs/io.js/pull/184
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-20 21:33:52 +01:00
Ben Noordhuis
6b2af5f0c7 benchmark: rename url.parse() benchmark
Rename the url.parse() benchmark from url.js to url-parse.js.
A follow-up commit is going to add another one for url.resolve().

PR-URL: https://github.com/iojs/io.js/pull/184
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-20 21:33:21 +01:00
Ben Noordhuis
d3f8db1244 lib: micro-optimize EventEmitter#removeListener()
Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.

Add a new benchmark to prove it.  With the change applied, it scores
a whopping 40% higher.

PR-URL: https://github.com/iojs/io.js/pull/185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-20 02:39:42 +01:00
Ben Noordhuis
d0c238cc81 benchmark: fix printing of large numbers
Don't use Number#toPrecision(), it switches to scientific notation for
numbers with more digits than the precision; use Number#toFixed().

PR-URL: https://github.com/iojs/io.js/pull/185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-20 02:38:47 +01:00
Ben Noordhuis
1a63b45a2a benchmark: pre-optimize url.parse() before start
Force V8 to optimize url.parse() before starting the actual benchmark.
Tries to minimize variance between successive runs caused by the
optimizer kicking in at different points.

It does not seem to have much impact, CPU times are roughly the same
before and afterwards; url.parse() quickly plateaus at a local optimum
where most time is spent in V8 builtins, notably Runtime_StringSplit()
and Object::GetElementWithReceiver() calls originating from
deps/v8/src/uri.js, with no recurring optimize/deoptimize cycles that
I could spot.

Still, I don't see any downsides to pre-optimizing the function being
benchmarked so in it goes.

PR-URL: https://github.com/iojs/io.js/pull/132
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-12-19 23:10:31 +01:00
cjihrig
5678595856 fs: deprecate exists() and existsSync()
These methods don't follow standard conventions, and shouldn't
be used anyway.

Fixes: https://github.com/iojs/io.js/issues/103
PR-URL: https://github.com/iojs/io.js/pull/166
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-19 10:27:48 -05:00
micnic
8c69d7bed4 domain: forward args to .run(fn)
Adds the feature to define arguments for the function called in
domain.run(), this is supposed to be useful when a function is called from
another context and some values from the current context are needed as
arguments, it's similar to the callback from setTimeout or setInterval.

PR-URL: https://github.com/iojs/io.js/pull/15
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-12 12:14:11 +11:00
Ben Noordhuis
21a679a10f benchmark: add url benchmarks
Based on the ad-hoc benchmark from joyent/node#8638 plus an additional
benchmark for user:pass auth URLs.

PR-URL: https://github.com/iojs/io.js/pull/102
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-09 22:16:41 +01:00
Robert Kowalski
efa47e593d benchmark: add test for module loader
Adds a test for benchmarking the module loader, needed for benchmarking
changes / refacortings in the module loader.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-09-24 15:48:55 -07:00
Ben Noordhuis
8ae32a9864 bench: fix buffers/buffer-base64-encode benchmark
The test is supposed to measure the performance of the base64 encoder
so move the Buffer#write() calls out of the benchmark section.

The overhead of the calls isn't terrible (about 1-3%) but having
unrelated activity in a micro-benchmark is never a good idea.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-06-04 14:37:27 -07:00
Raymond Feng
329103540c doc: Add a README for benchmark tests
The README.md documents how to run node core benchmark tests and
how to write new tests.
2014-05-28 11:58:08 -07:00
Raymond Feng
4c672c8a5e benchmark: Add a test to measure Buffer.slice perf
Buffer.slice can be expensive. One regression was reported by https://github.com/joyent/node/issues/7633. The method should be benchmarked.
2014-05-28 11:57:05 -07:00
Sean McArthur
226f98a356 buffer: add compare and equals methods
compare() works like String.localeCompare such that:

    Buffer.compare(a, b) === a.compare(b);

equals() does a native check to see if two buffers are equal.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-28 22:09:48 -07:00
Nick Apperson
d4fcb23e38 buffer: improve {read,write}{U}Int* methods
Increase the performance and simplify the logic of Buffer#write{U}Int*
and Buffer#read{U}Int* methods by placing the byte manipulation code
directly inline.

Also improve the speed of buffer-write benchmarks by creating a new
call directly to each method by using Function() instead of calling by
buff[fn].

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-01 17:31:28 -07:00
Timothy J Fontaine
bfc823de90 benchmark: update to use new wrk 2014-02-25 11:28:46 -08:00
Fedor Indutny
9836a4eeda stream_wrap: use uv_try_write where possible
Use `uv_try_write` for string and buffer writes, thus avoiding to do
allocations and copying in some of the cases.
2014-01-29 02:49:03 +04:00
Fedor Indutny
f5ab3e4c5c benchmark: fixate ciphers in tls benchmarks
Benchmark should always use the same cipher in order to be truthful.
2013-12-07 02:32:03 +04:00
Jackson Tian
60958d235d benchmark: Correct the bufferSize to highWaterMark
The bufferSize has been removed. Use highWaterMark instead of.
2013-11-06 16:32:22 +04:00
Ben Noordhuis
df3537102b benchmark: add http chunked encoding benchmarks
Test both "Content-Length: xxx" and "Transfer-Encoding: chunked" responses in
the http/simple benchmark.
2013-11-01 15:44:44 +01:00
isaacs
2be09f9493 Merge remote-tracking branch 'ry/v0.10' 2013-08-31 17:58:44 -07:00
isaacs
00a1d3633c benchmark: Fix execArgv handling
Bug in 01f3b46 causes the same benchmark to be run repeatedly.

Not so useful for the compare scripts.
2013-08-31 17:58:17 -07:00
isaacs
cece100082 Merge remote-tracking branch 'ry/v0.10' 2013-08-31 11:29:51 -07:00
isaacs
01f3b468a9 benchmark: Support passing v8 flags to benchmarks
The better to test --use-strict effects on performance.

(Spoiler: it has no measurable effect on performance.)
2013-08-31 10:36:44 -07:00
Matthew Aynalem
c171c490f2 fixes #6031 spelling errors
explictly => explicitly
accesss => access
througput => throughput
epxression => expression
communiction => communication
becuase => because
repersent => represent
condonitions => conditions
decompresion => decompression
intentially => intentionally
eventes => events
listning => listening
resicved => received
becuase => because
fundimental => fundamental
colapse => collapse
privlages => privileges
sufficently => sufficiently
hapepns => happens
expliclitly => explicitly
thier => their
shold => should
2013-08-19 16:42:16 -07:00
Trevor Norris
9a29aa8c55 benchmark: update misc to new v8 API 2013-08-01 15:02:38 -07:00
Ben Noordhuis
d75f67f949 bench: fix up benchmarks after internal api change 2013-07-20 12:13:54 +02:00
Trevor Norris
22668db73d benchmark: update callbacks only receive data
Since the SlabAllocator was removed the buffer length/offset is no
longer sent to the onread callback. The benchmarks have been updated to
reflect that.
2013-07-08 16:53:41 -07:00
isaacs
ba048e72b0 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	configure
	deps/uv/ChangeLog
	deps/uv/src/unix/darwin.c
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	deps/v8/src/isolate.cc
	deps/v8/src/version.cc
	lib/http.js
	src/node_version.h
2013-05-27 14:46:52 -07:00
Ben Noordhuis
fda2b319dc http: save roundtrips, convert buffers to strings
This commit adds an optimization to the HTTP client that makes it
possible to:

* Pack the headers and the first chunk of the request body into a
  single write().

* Pack the chunk header and the chunk itself into a single write().

Because only one write() system call is issued instead of several,
the chances of data ending up in a single TCP packet are phenomenally
higher: the benchmark with `type=buf size=32` jumps from 50 req/s to
7,500 req/s, a 150-fold increase.

This commit removes the check from e4b716ef that pushes binary encoded
strings into the slow path. The commit log mentions that:

    We were assuming that any string can be concatenated safely to
    CRLF.  However, for hex, base64, or binary encoded writes, this
    is not the case, and results in sending the incorrect response.

For hex and base64 strings that's certainly true but binary strings
are 'das Ding an sich': string.length is the same before and after
decoding.

Fixes #5528.
2013-05-23 02:13:26 +02:00
isaacs
61c9f78c63 Merge remote-tracking branch 'ry/v0.10' into master
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/ChangeLog
	deps/uv/config-unix.mk
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	deps/uv/uv.gyp
	src/node.cc
	src/node_buffer.cc
	src/node_crypto.cc
	src/node_version.h
	src/stream_wrap.cc
	src/stream_wrap.h
2013-05-17 14:04:54 -07:00
isaacs
201baa273b benchmark: hash stream 2013-05-14 11:36:04 -07:00
Fedor Indutny
f2d5cea73a benchmark: add chunked-encoding benchmark 2013-04-27 21:03:40 +04:00
Ben Noordhuis
05bd6b7bcd bench: add child process read perf benchmark 2013-03-25 13:16:07 +01:00
Trevor Norris
31314b6978 bench: compare binaries equal times
The benchmark compare would drop the last run of the binary pairs. So
when they were only run once an error would arise because no data was
generated for the second binary.
2013-03-20 20:25:48 +01:00
Ben Noordhuis
3dac421393 bench: add dgram send/recv benchmark 2013-03-20 17:16:30 +01:00
isaacs
d62cf59dc1 http: Don't hot-path end() for large buffers
The benefits of the hot-path optimization below start to fall off when
the buffer size gets up near 128KB, because the cost of the copy is more
than the cost of the extra write() call.  Switch to the write/end method
at that point.

Heuristics and magic numbers are awful, but slow http responses are
worse.

Fix #4975
2013-03-14 08:04:59 -07:00
isaacs
e7b8bad3d9 bench: Do math on numbers in compare.js, not strings 2013-03-07 11:56:53 -08:00
isaacs
db5d58e842 bench: Use environ to run compares more than once
This will run the benchmarks the number of times specified by NODE_BENCH_RUNS,
to attempt to reduce variability.

If the number of runs is high enough, it'll also throw out the top and bottom
quartiles, since that's where the outliers will be.

It's not very fancy statistics-fu, but it's better than nothing.

Also, linted this file.  It had tabs in it.  TABS!
2013-03-06 12:33:05 -08:00
isaacs
e4383c0170 bench: Add flag to be silent in runner
This is helpful in tracking down bailouts and deopts in Stream classes,
without triggering one from the string write in console.log
2013-03-05 14:23:01 -08:00
isaacs
88befa6021 bench: Make http easier to profile
Do not run the http/simple.js server in a child process.

Fix #4831
2013-02-25 17:47:28 -08:00
isaacs
053e02ef8e benchmark: Fix alignment issues on --html compare output 2013-02-20 09:17:29 -08:00
isaacs
bd4d585b7a bench: Add bench-crypto 2013-02-19 17:16:55 -08:00
isaacs
4b80f217cd bench: Simplify duration arguments to benchmarks
For throughput benchmarks, run with just 5s durations rather than 1s and 3s.

For startup benchmark, run with just a single 1s duration, since it's very
consistent anyway.
2013-02-19 17:16:55 -08:00
isaacs
2ed56e5235 bench: Consistency in benchmark filenames 2013-02-19 17:16:55 -08:00
isaacs
06fbcca6bb bench: Remove _bench_timer (no loner used) 2013-02-19 17:16:55 -08:00
isaacs
ef08f0fbb1 bench: Use wrk for http benchmarking
Remove ab, since it's no longer used.
2013-02-19 17:16:29 -08:00
isaacs
035aa6b4ce bench: Show % change rather than % difference 2013-02-19 14:14:39 -08:00
isaacs
087c437961 bench: Add --html to compare script 2013-02-19 14:14:38 -08:00
isaacs
7658f4c29c bench: Fail gracefully if function_call binding fails 2013-02-19 14:14:38 -08:00
isaacs
7d51745827 bench: Remove old run script 2013-02-19 14:14:37 -08:00
isaacs
0a406869df bench: Replace tls-fragmentation with tls/throughput 2013-02-19 14:14:37 -08:00
isaacs
bafc51c0f9 bench: Move tls-connect into benchmark/tls
Also, make it work properly with current node.
2013-02-19 14:14:37 -08:00
isaacs
8c719f7c71 bench: Make io.c output easier to read 2013-02-19 14:14:37 -08:00
isaacs
8a3f52170e bench: Remove io.js
Better covered by the other benchmark/fs scripts.
2013-02-19 14:14:36 -08:00
isaacs
2a64edb025 bench: Add fs write stream throughput 2013-02-19 14:14:36 -08:00
isaacs
1fc6f99340 bench: Add read-stream throughput 2013-02-19 14:14:36 -08:00
isaacs
6d116be7cf bench: Move fs-readfile.js to fs/readfile.js 2013-02-19 14:14:35 -08:00
isaacs
844b33205c bench: Move v8_bench into misc 2013-02-19 14:14:35 -08:00
isaacs
2a2942bd7f bench: Move string_creation into misc 2013-02-19 14:14:35 -08:00
isaacs
fef35fc4f1 bench: Remove settimeout (Covered by misc/timeout.js) 2013-02-19 14:14:35 -08:00
isaacs
3761be3d99 bench: Move timers to misc/timers 2013-02-19 14:14:34 -08:00
isaacs
7e5cd08061 bench: move next-tick to misc/next-tick-breadth 2013-02-19 14:14:34 -08:00
isaacs
f7a4ccb409 bench: Move nexttick-2 to misc/next-tick-depth
x
2013-02-19 14:14:34 -08:00
isaacs
44be55fc4e bench: Move process_loop to misc/spawn-echo 2013-02-19 14:14:34 -08:00
isaacs
4e1bcdcab9 bench: Add function_call to bench-misc 2013-02-19 14:14:33 -08:00
isaacs
e87ed91fac bench: Arrays 2013-02-19 14:14:33 -08:00
isaacs
3f67a48dd4 bench: Add buffers/dataview_set 2013-02-19 14:14:33 -08:00
isaacs
56b22956ad bench: Remove unused 'fast_buffer2' benchmarks 2013-02-19 14:14:33 -08:00
isaacs
048f7fd37c bench: Merge fast_buffer_creation and buffer_creation 2013-02-19 14:14:32 -08:00
isaacs
55aa2571a0 bench: Buffer read/write benchmarks 2013-02-19 14:14:32 -08:00
isaacs
419607e8eb bench: Buffer creation 2013-02-19 14:14:32 -08:00
isaacs
cc38528acf bench: buffer-base64-encode 2013-02-19 14:14:32 -08:00
isaacs
921c3c2097 bench: misc/startup.js 2013-02-19 14:14:31 -08:00
isaacs
3b16657e77 bench: misc/url 2013-02-19 14:14:31 -08:00
isaacs
536ce44689 bench: http benchmarks
Also: make http_simple less chatty
2013-02-19 14:14:31 -08:00
isaacs
d5d04a51d6 bench: Remove client_latency
No one actually knows what this is supposed to be doing,
anyway.  It's not a good benchmark.
2013-02-19 14:14:31 -08:00
isaacs
051c1317f9 bench: Remove throughput (covered by benchmark/net) 2013-02-19 14:14:30 -08:00
isaacs
e82f97401f bench: net benchmarks using common script 2013-02-19 14:14:30 -08:00
isaacs
baea73ccda bench: Move net-pipe into benchmark/net 2013-02-19 14:14:30 -08:00
isaacs
aa2edd4b89 bench: A compare script for analyzing benchmarks 2013-02-19 14:14:30 -08:00
isaacs
37077de83d bench: add runner 2013-02-19 14:14:29 -08:00
isaacs
dd069a2539 bench: Add ab() method to common for http testing 2013-02-19 14:14:29 -08:00
isaacs
00e1962495 bench: Add common script 2013-02-19 14:14:29 -08:00
isaacs
8476aefc8e fs: Change default WriteStream config, increase perf
This increases fs.WriteStream throughput dramatically by removing the
"higher default water marks" for fs.WriteStream.

Also includes a benchmark.  Current performance is significantly higher
than v0.8 for strings at all tested levels except size=1.  Buffer
performance is still lackluster.

Further improvement in the stream.Writable base class is required, but
this is a start.
2013-02-15 18:48:43 -08:00
Ben Noordhuis
19d29aa0e8 bench: make io.c file path configurable 2013-02-12 19:38:29 +01:00
isaacs
ae6f4b32c4 benchmark: Add resume() in static_http_server 2013-01-17 14:54:59 -08:00
Trevor Norris
22b84e6216 buffer: floating point read/write improvements
Improvements:
* floating point operations are approx 4x's faster
* Now write quiet NaN's
* all read/write on floating point now done in C, so no more need for
  lib/buffer_ieee754.js
* float values have more accurate min/max value checks
* add additional benchmarks for buffers read/write
* created benchmark/_bench_timer.js which is a simple library that
  can be included into any benchmark and provides an intelligent tracker
  for sync and async tests
* add benchmarks for DataView set methods
* add checks and tests to make sure offset is greater than 0
2013-01-16 10:17:20 -08:00
isaacs
7550e31d1a benchmark: Make flamegraphs a bit more useful 2012-12-29 15:32:26 -08:00
isaacs
ecdde7df15 benchmark: Set port range properly on Linux 2012-12-29 15:32:26 -08:00
Ben Noordhuis
a329729537 buffer: speed up base64 encoding by 20%
Remove a lot of branches from the inner loop. Speeds up buf.toString('base64')
by about 20%.

Before:

  $ time out/Release/node benchmark/buffer-base64-encode.js
  real    0m6.607s
  user    0m5.508s
  sys     0m1.088s

After:

  $ time out/Release/node benchmark/buffer-base64-encode.js
  real    0m5.520s
  user    0m4.520s
  sys     0m0.992s
2012-12-28 13:20:07 +01:00
isaacs
ec7455558f benchmark: Set ephemeral ports properly on sunos 2012-12-21 00:07:35 +00:00
isaacs
825af451fb benchmark: Make http.sh more useful 2012-12-21 00:07:34 +00:00
isaacs
79ec9dc1dd benchmark: Support names in http-flamegraph 2012-12-21 00:07:34 +00:00
isaacs
836593da23 benchmark: Improve http-flamegraph 2012-12-21 00:07:34 +00:00
Ben Noordhuis
d1556fbdd2 bench: report stats in benchmark/net-pipe 2012-12-20 14:48:51 +01:00
Ben Noordhuis
79ae8b7ae2 Merge remote-tracking branch 'origin/v0.8' 2012-12-20 12:39:04 +01:00
Ben Noordhuis
ba407ce410 bench: use res.end() for chunked encoding
Use res.end() for the final chunk so we can benchmark the 'hot path' shortcut
in lib/http.js that packs the headers and the body into a single packet.
2012-12-20 11:44:10 +01:00
isaacs
43538f4f8f benchmark: Add http-flamegraph
This is very similar to http.sh, but generates a flamegraph
with dtrace, pruning off the single-hit stacks so that we can
more easily see the places where relevant amounts of time are
spent.
2012-12-18 11:56:53 -08:00
isaacs
7742257feb benchmark: Add once() function to net-pipe benchmark fixture 2012-12-14 10:52:29 -08:00
isaacs
3149d2f7dc benchmark: Add net-pipe benchmark
Just sends a buffer to a server, which echoes it back, and then measures
the Gbits/second.  Very similar to throughput.js, but using a single
process, so that it's possible to dtrace and get the jsstack frames for
profile comparison.
2012-11-30 18:26:18 -08:00
isaacs
e2bcff9aa7 bench: Use hrtime in throughput benchmark 2012-11-11 10:02:33 -08:00
Ben Noordhuis
2c97da82f5 bench: correct time calculation in url.js 2012-09-13 14:02:22 +02:00
Ben Noordhuis
10ba95c11a bench: improve url parser benchmark 2012-09-13 01:21:54 +02:00
Felix Böhm
f5c68b280f bench: add url parser benchmark 2012-09-13 01:21:53 +02:00
jbergstroem
8eccc417a7 bench: fetch port from env
http_simple.js honors $PORT, http_simple_bench.sh should too.
2012-08-13 18:52:06 +02:00
Bert Belder
23dc099299 benchmark: add single process tls connection benchmark 2012-07-14 01:43:34 +02:00
Bert Belder
d2e40f66cc Merge branch 'v0.6' into v0.8 2012-07-12 03:30:04 +02:00
isaacs
8a946c2ee7 benchmark: Backport improvements made in master
Ported to v0.6 for easier comparison in the 0.8.0 blog post.
2012-06-23 10:03:12 -07:00
Bert Belder
6e5217d320 Fix bug in io benchmark 2012-06-21 20:52:38 +02:00
Ben Noordhuis
5ff2ae8389 bench: start a worker for each CPU 2012-05-25 00:35:10 +02:00
Ben Noordhuis
7535e3930a bench: add http_simple_auto benchmark
Starts a server and benchmarks it with ab.
2012-05-25 00:35:07 +02:00
isaacs
ee6c11876a benchmark for fs.readfile 2012-05-16 20:04:44 -07:00
Bert Belder
4ddafbd563 Benchmark: add /unicode/nnn bench to http_simple.js 2012-05-09 03:56:09 +02:00
Bert Belder
7f68f256cf Benchmark: clean up http_simple.js 2012-05-09 03:56:07 +02:00
Ben Noordhuis
12a90e98bf bench: add continuous stress test
Useful in tracking down or at least demonstrating memory leaks.
2012-04-27 23:11:32 +02:00
Ben Noordhuis
4e84dfa683 bench: run GC and dump stats if --expose-gc is set 2012-04-27 20:38:58 +02:00
isaacs
45c1d4f96f Add switches to http_simple bench to use domains 2012-04-17 13:14:55 -07:00
Ben Noordhuis
11770bf5e2 test: move pummel/test-tls-fragmentation to benchmark/
Said test takes over 90 seconds on my Core 2 Duo which is too long, even for
the pummel tests.
2012-03-29 17:25:37 +02:00
Bert Belder
408f450286 client latency benchmark: don't require('request') 2012-03-07 04:52:29 +01:00
isaacs
150053b3fa Typo in http_server_lag.js script
Thanks, @mscdex
2012-03-06 19:31:16 -08:00