From 24fddba59b521015922c3a8d65ef8d9dd409a5c7 Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Sun, 9 Aug 2020 17:47:51 +0530 Subject: [PATCH] benchmark: add benchmark script for resourceUsage Added a benchmark script for process method to benchmark the method resourceUsage. PR-URL: https://github.com/nodejs/node/pull/34691 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Mary Marchini Reviewed-By: James M Snell Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- benchmark/process/resourceUsage.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 benchmark/process/resourceUsage.js diff --git a/benchmark/process/resourceUsage.js b/benchmark/process/resourceUsage.js new file mode 100644 index 00000000000000..83871db680b3b7 --- /dev/null +++ b/benchmark/process/resourceUsage.js @@ -0,0 +1,14 @@ +'use strict'; + +const common = require('../common.js'); +const bench = common.createBenchmark(main, { + n: [1e5] +}); + +function main({ n }) { + bench.start(); + for (let i = 0; i < n; i++) { + process.resourceUsage(); + } + bench.end(n); +}