Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: add --expose_internals switch #8547

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ Benchmark.prototype._run = function() {
}

const child = child_process.fork(require.main.filename, childArgs, {
env: childEnv
env: childEnv,
execArgv: ['--expose_internals'].concat(process.execArgv)
});
child.on('message', sendResult);
child.on('close', function(code) {
Expand Down
5 changes: 4 additions & 1 deletion benchmark/misc/freelist.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
'use strict';

var common = require('../common.js');
var FreeList = require('internal/freelist').FreeList;

var bench = common.createBenchmark(main, {
n: [100000]
});

function main(conf) {
// Using internal/freelist requires node to be run with --expose_internals
// switch. common.js will do that when calling main(), so we require
// this module here
const FreeList = require('internal/freelist').FreeList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this? Maybe add a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require was moved there, so it will work with adding -expose_internals only in common.js. It was the result of discusion here: #8547 (review)

var n = conf.n;
var poolSize = 1000;
var list = new FreeList('test', poolSize, Object);
Expand Down