diff --git a/benchmark/vm/context-global-proxy.js b/benchmark/vm/context-global-proxy.js new file mode 100644 index 00000000000000..3f461671b195e1 --- /dev/null +++ b/benchmark/vm/context-global-proxy.js @@ -0,0 +1,21 @@ +'use strict'; + +const common = require('../common.js'); + +const bench = common.createBenchmark(main, { + n: [100000], +}); + +const vm = require('vm'); +const script = new vm.Script(` + globalThis.foo++; +`); +const context = vm.createContext({ foo: 1 }); + +function main({ n }) { + bench.start(); + for (let i = 0; i < n; i++) { + script.runInContext(context); + } + bench.end(n); +}