From 99a2dd03cd286176d639ec898a08f27c1567f85c Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Fri, 16 Sep 2016 12:31:22 +0200 Subject: [PATCH] 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 Reviewed-By: Andreas Madsen PR-URL: https://github.com/nodejs/node/pull/8547 --- benchmark/common.js | 3 ++- benchmark/misc/freelist.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/benchmark/common.js b/benchmark/common.js index adc04a0b80..495d6fdf36 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -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) { diff --git a/benchmark/misc/freelist.js b/benchmark/misc/freelist.js index 7956dc3d6b..a2732c9bc8 100644 --- a/benchmark/misc/freelist.js +++ b/benchmark/misc/freelist.js @@ -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);