summaryrefslogtreecommitdiff
path: root/benchmark/module
AgeCommit message (Collapse)Author
2019-11-01module: warn on using unfinished circular dependencyAnna Henningsen
Warn when a non-existent property of an unfinished module.exports object is being accessed, as that very often indicates the presence of a hard-to-detect and hard-to-debug problem. This mechanism is only used if `module.exports` is still a regular object at the point at which the second, circular `require()` happens. The downside is that, temporarily, `module.exports` will have a prototype other than `Object.prototype`, and that there may be valid uses of accessing non-existent properties of unfinished `module.exports` objects. Performance of circular require calls in general is not noticeably impacted. confidence improvement accuracy (*) (**) (***) module/module-loader-circular.js n=10000 3.96 % ±5.12% ±6.82% ±8.89% Example: $ cat a.js 'use strict'; const b = require('./b.js'); exports.fn = () => {}; $ cat b.js 'use strict'; const a = require('./a.js'); a.fn(); $ node a.js (node:1617) Warning: Accessing non-existent property 'fn' of module exports inside circular dependency /tmp/b.js:4 a.fn(); ^ TypeError: a.fn is not a function at Object.<anonymous> (/tmp/b.js:4:3) [...] PR-URL: https://github.com/nodejs/node/pull/29935 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-04benchmark: improve module-loader benchmarkRuben Bridgewater
Add more benchmark options to properly verify the gains. This makes sure the benchmark also tests requiring the same module again instead of only loading each module only once. PR-URL: https://github.com/nodejs/node/pull/26970 Refs: https://github.com/nodejs/node/pull/25362 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-04benchmark: add new module loading benchmarksRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/26970 Refs: https://github.com/nodejs/node/pull/25362 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-11-06benchmark: remove unused catch bindingscjihrig
PR-URL: https://github.com/nodejs/node/pull/24079 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com>
2018-04-10benchmark: changed millions and thousands to njuggernaut451
PR-URL: https://github.com/nodejs/node/pull/18917 Fixes: https://github.com/nodejs/node/issues/18778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2018-02-01benchmark: refactorRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/18320 Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-31test: move tmpdir to submodule of commonRich Trott
Move tmpdir functionality to its own module (common/tmpdir). PR-URL: https://github.com/nodejs/node/pull/17856 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-01-23benchmark: use destructuringRuben Bridgewater
This applies to all `async_hooks`, `dns`, `cluster`, `domain` and `module` benchmarks. PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-12benchmark: remove writing to benchmark directoryRich Trott
A benchmark for module loading creates a temporary directory in the benchmark directory. Re-use the test common module to put the tmp directory in test instead. This was causing intermittent test failures because run.js (invoked by benchmark tests, mulitple of which could be running at once) throws if a subdirectory of benchmark disappears at just the wrong time. There are other possible solutions than repurposing the `test/common` module but two arguments for doing it this way are: * There is already another benchmark file that does this (`http_server_for_chunky_client.js`) so the dependency already exists in the benchmarks. * This also eliminates a re-implementation of rimraf in the benchmark code. PR-URL: https://github.com/nodejs/node/pull/16144 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-19benchmark: var to constRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/13757 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
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-03-21benchmark: add final clean-up to module-loader.jsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/11924 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-10benchmark: add parameter for module benchmarkBrian White
PR-URL: https://github.com/nodejs/node/pull/10789 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
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-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-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 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>