summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRafael Gonzaga <rafael.nunu@hotmail.com>2023-04-04 14:14:04 -0300
committerGitHub <noreply@github.com>2023-04-04 17:14:04 +0000
commit6fd147c4b08550e4d82ed54f21b9c737ac6d58b0 (patch)
treec5ffa0e38ffa3660e6899e0c4faf1a695eaa51f8 /benchmark
parent7ec93fb296a79d0da7e327a4bdc504b0e8a2b3a9 (diff)
downloadnode-new-6fd147c4b08550e4d82ed54f21b9c737ac6d58b0.tar.gz
permission: drop process.permission.deny
PR-URL: https://github.com/nodejs/node/pull/47335 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/permission/permission-fs-deny.js19
-rw-r--r--benchmark/permission/permission-fs-read.js (renamed from benchmark/permission/permission-fs-is-granted.js)18
2 files changed, 3 insertions, 34 deletions
diff --git a/benchmark/permission/permission-fs-deny.js b/benchmark/permission/permission-fs-deny.js
deleted file mode 100644
index 29bbeb27dc..0000000000
--- a/benchmark/permission/permission-fs-deny.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-const common = require('../common.js');
-
-const configs = {
- n: [1e5],
- concurrent: [1, 10],
-};
-
-const options = { flags: ['--experimental-permission'] };
-
-const bench = common.createBenchmark(main, configs, options);
-
-async function main(conf) {
- bench.start();
- for (let i = 0; i < conf.n; i++) {
- process.permission.deny('fs.read', ['/home/example-file-' + i]);
- }
- bench.end(conf.n);
-}
diff --git a/benchmark/permission/permission-fs-is-granted.js b/benchmark/permission/permission-fs-read.js
index 062ba19445..bd81814e55 100644
--- a/benchmark/permission/permission-fs-is-granted.js
+++ b/benchmark/permission/permission-fs-read.js
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
-const fs = require('fs/promises');
const path = require('path');
const configs = {
@@ -19,22 +18,11 @@ const options = {
const bench = common.createBenchmark(main, configs, options);
-const recursivelyDenyFiles = async (dir) => {
- const files = await fs.readdir(dir, { withFileTypes: true });
- for (const file of files) {
- if (file.isDirectory()) {
- await recursivelyDenyFiles(path.join(dir, file.name));
- } else if (file.isFile()) {
- process.permission.deny('fs.read', [path.join(dir, file.name)]);
- }
- }
-};
-
+// This is a naive benchmark and might not demonstrate real-world use cases.
+// New benchmarks will be created once the permission model config is available
+// through a config file.
async function main(conf) {
const benchmarkDir = path.join(__dirname, '../..');
- // Get all the benchmark files and deny access to it
- await recursivelyDenyFiles(benchmarkDir);
-
bench.start();
for (let i = 0; i < conf.n; i++) {