Browse Source

benchmark: add --expose_internals switch

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
v6
Bartosz Sosnowski 8 years ago
parent
commit
99a2dd03cd
  1. 3
      benchmark/common.js
  2. 5
      benchmark/misc/freelist.js

3
benchmark/common.js

@ -137,7 +137,8 @@ Benchmark.prototype._run = function() {
} }
const child = child_process.fork(require.main.filename, childArgs, { 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('message', sendResult);
child.on('close', function(code) { child.on('close', function(code) {

5
benchmark/misc/freelist.js

@ -1,13 +1,16 @@
'use strict'; 'use strict';
var common = require('../common.js'); var common = require('../common.js');
var FreeList = require('internal/freelist').FreeList;
var bench = common.createBenchmark(main, { var bench = common.createBenchmark(main, {
n: [100000] n: [100000]
}); });
function main(conf) { 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;
var n = conf.n; var n = conf.n;
var poolSize = 1000; var poolSize = 1000;
var list = new FreeList('test', poolSize, Object); var list = new FreeList('test', poolSize, Object);

Loading…
Cancel
Save