Commit Graph

232 Commits

Author SHA1 Message Date
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