Skip to content

Commit

Permalink
benchmark: add --expose_internals switch
Browse files Browse the repository at this point in the history
Adds --expose_internals switch to benchmark runner. This makes
misc/freelist.js benchmark run properly

Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Andreas Madsen <[email protected]>
PR-URL: #8547
  • Loading branch information
bzoz authored and jasnell committed Sep 29, 2016
1 parent e97fe46 commit 84481f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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;
var n = conf.n;
var poolSize = 1000;
var list = new FreeList('test', poolSize, Object);
Expand Down

0 comments on commit 84481f9

Please sign in to comment.