summaryrefslogtreecommitdiff
path: root/benchmark/common.js
AgeCommit message (Collapse)Author
2019-02-07benchmark: remove unreachable returnZYSzys
PR-URL: https://github.com/nodejs/node/pull/25883 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-01-31benchmark: refactor benchmark/common.jsRich Trott
Refactor benchmark/common.js to consistently use arrow functions for anonymous callbacks and trailing commas. PR-URL: https://github.com/nodejs/node/pull/25805 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-12-10tools: capitalize sentencesRuben Bridgewater
This adds the `capitalized-comments` eslint rule to verify that actual sentences use capital letters as starting letters. It ignores special words and all lines below 62 characters. PR-URL: https://github.com/nodejs/node/pull/24808 Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-11-20benchmark: pre-generate data set for URL benchmarksJoyee Cheung
This patch: - Introduces `common.bakeUrlData` which can be used to pre-generate the data set for the URL benchmarks to loop through instead of looping over a constant. - Add the option to use WPT data in benchmarks for better diversity in the input - Add the option to benchmark URL parsing with base URLs (whatwg only) - Moves the data in `benchmark/fixtures/url-inputs.js` to `benchmark/common.js` PR-URL: https://github.com/nodejs/node/pull/24302 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-11build: use BUILDTYPE in bench-addons-build targetsDaniel Bevenius
This commit uses the BUILDTYPE for the benchmark targets that currently explicitly use Release as the build type. The motivation for this change is allows switching between debug builds and release builds using the bench-addons-clean/bench-addons-build targets. PR-URL: https://github.com/nodejs/node/pull/24033 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-10-14benchmark: add common.binding()cjihrig
Recently, process.binding() was replaced with internalBinding(). However, internalBinding() is not available on older builds of Node, which are often used for benchmarking purposes. This commit adds a common.binding() to the benchmarks to work around the issue. Hopefully, this can be removed in the not too distant future. PR-URL: https://github.com/nodejs/node/pull/23460 Fixes: https://github.com/nodejs/node/issues/23436 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2017-06-19benchmark: remove needless RegExp capturingVse Mozhet Byt
Use non-capturing grouping or remove capturing completely when: * capturing is useless per se, e.g. in test() check; * captured groups are not used afterwards at all; * some of the later captured groups are not used afterwards. PR-URL: https://github.com/nodejs/node/pull/13718 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-06-12benchmark: fix some RegExp nitsVse Mozhet Byt
* Take RegExp creation out of cycle. * use test(), not match() in boolean context. PR-URL: https://github.com/nodejs/node/pull/13551 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-05-21benchmark: allow no duration in benchmark testsRich Trott
Imprecision in process.hrtime() in some situations can result in a zero duration being used as a denominator in benchmark tests. This would almost certainly never happen in real benchmarks. It is only likely in very short benchmarks like the type we run in our test suite to just make sure that the benchmark code is runnable. So, if the environment variable that we use in tests to indicate "allow ludicrously short benchmarks" is set, convert a zero duration for a benchmark to 1 nano-second. PR-URL: https://github.com/nodejs/node/pull/13110 Fixes: https://github.com/nodejs/node/issues/13102 Fixes: https://github.com/nodejs/node/issues/12433 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-05-11benchmark: check for time precision in common.jsRich Trott
Some benchmark tests are failing intermittently, possibly due to hrtime() imprecision on particular hosts. This change will confirm or refute that as the root cause the next time the test fails on CI. Either way, it's a valid check. PR-URL: https://github.com/nodejs/node/pull/12934 Ref: https://github.com/nodejs/node/issues/12497 Ref: https://github.com/nodejs/node/issues/12433 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20benchmark: reduce string concatenationsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12455 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20benchmark: fix CLI arguments check in common.jsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12429 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-17Revert "benchmark: fix CLI arguments check in common.js"James M Snell
This reverts commit e34f8e1444d1e52f4501ccc289cdb83da93e48f0. PR-URL: https://github.com/nodejs/node/pull/12474 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-17benchmark: fix CLI arguments check in common.jsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12429 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-28benchmark: check end() argument to be > 0Vse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12030 Ref: https://github.com/nodejs/node/issues/11972 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-03-22benchmark: allow multiple values for same configNikolai Vavilov
This allows running a benchmark with two or more values for the same config rather than just one or all of them, for example: ``` node benchmark/buffers/buffer-creation.js type=buffer() type=fast-alloc type=fast-alloc-fill ``` PR-URL: https://github.com/nodejs/node/pull/11819 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
2017-03-06benchmark: cleanup after forced optimization dropBartosz Sosnowski
This removes all instances of %OptimizeFunctionOnNextCall from common.js and README.md PR-URL: https://github.com/nodejs/node/pull/9615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-01-31benchmark: add progress indicator to compare.jsJoyee Cheung
* Print the progress bar and the current benchmark to stderr when stderr is TTY and stdout is not. * Allow cli arguments without values via setting.boolArgs * Add --no-progress option PR-URL: https://github.com/nodejs/node/pull/10823 Fixes: https://github.com/nodejs/node/issues/8659 Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2017-01-05benchmark: keep decimals in resultsBrian White
Some benchmarks' results are small values, so keeping decimals when running them manually (not comparing) can be helpful. PR-URL: https://github.com/nodejs/node/pull/10559 Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-04benchmark: allow benchmarks to specify flagsJoyee Cheung
* Give createBenchmark and the Benchmark constructor a third argument for specifying the command line flags that this benchmark should be run with. The benchmarks are no longer run with --expose-internals by default, they will need to explicitly pass the flags. * Rename options to configs in createBenchmark and the Benchmark constructor to match the documentation since they are not optional. * Comment the properties of a Benchmark object Also improve the documentation about creating benchmarks * Add detailed description of the arguments of `createBenchmark` * Describe the two passes of running the benchmarks * Suggest what kind of code should go where in the benchmark example PR-URL: https://github.com/nodejs/node/pull/10448 Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
2016-12-23benchmark: use commas in non-csv rate outputBrian White
PR-URL: https://github.com/nodejs/node/pull/10360 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-17benchmark: use node v4 syntax in common.jsAndreas Madsen
Using new syntax such as `...args` means that the benchmark suite can't be used with older node versions. This changes the `...args` syntax to a good old `Array.prototype.slice`. Refs: https://github.com/nodejs/node/pull/8932#issuecomment-252924107 PR-URL: https://github.com/nodejs/node/pull/9064 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
2016-09-26benchmark: add --expose_internals switchBartosz Sosnowski
Adds --expose_internals switch to benchmark runner. This makes misc/freelist.js benchmark run properly Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> PR-URL: https://github.com/nodejs/node/pull/8547
2016-08-31benchmark: support for multiple http benchmarkersBartosz Sosnowski
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-12benchmark: fix comment typos and code formatAdrian Nitu
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-07-26benchmark: refactor to use process.sendAndreas Madsen
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-26benchmark: move cli parts of common.js into run.jsAndreas Madsen
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-06-14benchmark: don't convert arguments to numbersBrian White
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-14http: optimize checkInvalidHeaderChar()Brian White
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-04-20benchmarks: add common.v8ForceOptimizationJames M Snell
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-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: 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-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-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>
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-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-04-09benchmark: don't check wrk in non-http benchmarkJackson Tian
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-03-16benchmark: add output format option [csv]Brendan Ashworth
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-05benchmark: fix `wrk` checkBrian White
PR-URL: https://github.com/iojs/io.js/pull/1076 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-03-04benchmark: check for wrk ahead of running benchmarksJohan Bergström
PR-URL: https://github.com/iojs/io.js/pull/982 Reviewed-By: Rod Vagg <rod@vagg.org>
2015-03-04build: remove tools/wrk from the treeJohan Bergström
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-02-24benchmark: pass execArgv to the benchmarking processPetka Antonov
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-04benchmark: don't use template stringsEvan Lucas
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-02benchmark: clean up common.jsBrendan Ashworth
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-01-21benchmark: print score to five decimal placesYosuke Furukawa
PR-URL: https://github.com/iojs/io.js/pull/516 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-17benchmark: add filter option for benchmarkYosuke Furukawa
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-14benchmark: fix command name in benchmark scriptsYosuke Furukawa
PR-URL: https://github.com/iojs/io.js/pull/410 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-20benchmark: fix printing of large numbersBen Noordhuis
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>
2013-08-31benchmark: Fix execArgv handlingisaacs
Bug in 01f3b46 causes the same benchmark to be run repeatedly. Not so useful for the compare scripts.
2013-08-31benchmark: Support passing v8 flags to benchmarksisaacs
The better to test --use-strict effects on performance. (Spoiler: it has no measurable effect on performance.)