summaryrefslogtreecommitdiff
path: root/benchmark
AgeCommit message (Collapse)Author
2016-04-15buffer: add Buffer.allocUnsafeSlow(size)James M Snell
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-14benchmark: add module loader benchmark parameterBrian White
PR-URL: https://github.com/nodejs/node/pull/5172 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-08buffer: add Buffer.prototype.compare by offsetJames M Snell
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-03-27http: speed up checkIsHttpTokenJackson Tian
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-27buffer: faster case for create buffer from empty stringJackson Tian
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-23buffer: add swap16() and swap32() methodsJames M Snell
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-21benchmark: fix linting errorsRich Trott
4d78121b7786ee5b676d45b9d11e9a89d8dd249c 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-21lib: simplify code with String.prototype.repeat()Jackson Tian
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-18timers: improve setImmediate() performanceBrian White
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-16buffer: add .from(), .alloc() and .allocUnsafe()James M Snell
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-07tools: enable no-self-assign ESLint ruleRich Trott
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-04benchmark: add util.format benchmarkEvan Lucas
PR-URL: https://github.com/nodejs/node/pull/5360 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-03benchmark: fix lint errorsRich Trott
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-02lib: freelist: use .pop() for allocationAnton Khlynovskiy
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-01benchmark: refactor to eliminate redeclared varsRich Trott
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-02-27benchmark: add benchmark for buf.compare()Rich Trott
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-27tools,benchmark: increase lint complianceRich Trott
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-26benchmark: move string-decoder to its own categoryAndreas Madsen
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-26benchmark: fix configuation parametersAndreas Madsen
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-26benchmark: merge url.js with url-resolve.jsAndreas Madsen
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-26benchmark: move misc to categorized directoriesAndreas Madsen
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-22benchmark: use strict modeRich Trott
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-12querystring: improve escape() performanceBrian White
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-12querystring: improve parse() performanceBrian White
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-09benchmark: split path benchmarksBrian White
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-09benchmark: allow empty parametersBrian White
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-09streams: 5% throughput gain when sending small chunksMatteo Collina
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-01-29dgram: support dgram.send with multiple buffersMatteo Collina
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-29benchmark: add a constant declaration for `net`Minwoo Jung
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-14querystring: improve parse() performanceBrian White
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>
2015-12-30util: faster arrayToHashJackson Tian
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-23buffer: faster case for create Buffer from new Buffer(0)Jackson Tian
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-21assert: typed array deepequal performance fixClaudio Rodriguez
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-17node: improve accessor perf of process.envTrevor Norris
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-17node: improve performance of hrtime()Trevor Norris
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-17fs: use pushValueToArray for readdir(Sync)Trevor Norris
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-17http_parser: use pushValueToArray for headersTrevor Norris
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-02meta: remove use of profanity in sourceMyles Borins
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-10-07src: replace naive search in Buffer::IndexOfKarl Skomski
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-09-29benchmark: update comment in common.jsMinwoo Jung
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-15doc: rename from iojs(1) to node(1) in benchmarksDmitry Vasilyev
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-06src: replace usage of v8::Handle with v8::LocalMichaël Zasso
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-08-23node: rename from io.js to nodecjihrig
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-20events: deprecate static listenerCount functionSakthipriyan Vairamani
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-07-26benchmark: add remaining path benchmarks & optimizeNathan Woltman
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-25src: make base64 decoding 50% fasterBen Noordhuis
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-04benchmark: Add some path benchmarks for #1778Nathan Woltman
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-06-29benchmark: make concurrent requests configurableRich Trott
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-29benchmark: fix typo in READMERich Trott
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-25buffer: optimize Buffer#toString()Ben Noordhuis
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>