mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
benchmark: use tmpdir.resolve()
PR-URL: https://github.com/nodejs/node/pull/49137 Refs: https://github.com/nodejs/node/pull/49079 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
9848352974
commit
fcf5de008a
@ -5,8 +5,7 @@ const common = require('../common.js');
|
|||||||
const { strictEqual } = require('assert');
|
const { strictEqual } = require('assert');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
const benchmarkDirectory =
|
const benchmarkDirectory = tmpdir.resolve('benchmark-esm-parse');
|
||||||
path.resolve(tmpdir.path, 'benchmark-esm-parse');
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
n: [1e2],
|
n: [1e2],
|
||||||
|
@ -8,8 +8,7 @@ const common = require('../common.js');
|
|||||||
const tmpdir = require('../../test/common/tmpdir.js');
|
const tmpdir = require('../../test/common/tmpdir.js');
|
||||||
const { pathToFileURL } = require('node:url');
|
const { pathToFileURL } = require('node:url');
|
||||||
|
|
||||||
const benchmarkDirectory =
|
const benchmarkDirectory = tmpdir.resolve('benchmark-import-meta-resolve');
|
||||||
path.resolve(tmpdir.path, 'benchmark-import-meta-resolve');
|
|
||||||
|
|
||||||
const configs = {
|
const configs = {
|
||||||
n: [1e4],
|
n: [1e4],
|
||||||
|
@ -8,8 +8,7 @@ const common = require('../common.js');
|
|||||||
const tmpdir = require('../../test/common/tmpdir.js');
|
const tmpdir = require('../../test/common/tmpdir.js');
|
||||||
const { pathToFileURL } = require('node:url');
|
const { pathToFileURL } = require('node:url');
|
||||||
|
|
||||||
const benchmarkDirectory =
|
const benchmarkDirectory = tmpdir.resolve('benchmark-import-meta-resolve');
|
||||||
path.resolve(tmpdir.path, 'benchmark-import-meta-resolve');
|
|
||||||
|
|
||||||
const parentURL = pathToFileURL(path.join(benchmarkDirectory, 'entry-point.js'));
|
const parentURL = pathToFileURL(path.join(benchmarkDirectory, 'entry-point.js'));
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
// Test the throughput of the fs.WriteStream class.
|
// Test the throughput of the fs.WriteStream class.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
const filename = path.resolve(tmpdir.path,
|
const filename = tmpdir.resolve(`.removeme-benchmark-garbage-${process.pid}`);
|
||||||
`.removeme-benchmark-garbage-${process.pid}`);
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
encodingType: ['buf', 'asc', 'utf'],
|
encodingType: ['buf', 'asc', 'utf'],
|
||||||
|
@ -3,15 +3,13 @@
|
|||||||
// Then see how many times it got called.
|
// Then see how many times it got called.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
const filename = path.resolve(tmpdir.path,
|
const filename = tmpdir.resolve(`.removeme-benchmark-garbage-${process.pid}`);
|
||||||
`.removeme-benchmark-garbage-${process.pid}`);
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
duration: [5],
|
duration: [5],
|
||||||
|
@ -3,15 +3,13 @@
|
|||||||
// Yes, this is a silly benchmark. Most benchmarks are silly.
|
// Yes, this is a silly benchmark. Most benchmarks are silly.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
const filename = path.resolve(tmpdir.path,
|
const filename = tmpdir.resolve(`.removeme-benchmark-garbage-${process.pid}`);
|
||||||
`.removeme-benchmark-garbage-${process.pid}`);
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
duration: [5],
|
duration: [5],
|
||||||
|
@ -3,15 +3,13 @@
|
|||||||
// Yes, this is a silly benchmark. Most benchmarks are silly.
|
// Yes, this is a silly benchmark. Most benchmarks are silly.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
const filename = path.resolve(tmpdir.path,
|
const filename = tmpdir.resolve(`.removeme-benchmark-garbage-${process.pid}`);
|
||||||
`.removeme-benchmark-garbage-${process.pid}`);
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
duration: [5],
|
duration: [5],
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
// Test the throughput of the fs.WriteStream class.
|
// Test the throughput of the fs.WriteStream class.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
const filename = path.resolve(tmpdir.path,
|
const filename = tmpdir.resolve(`.removeme-benchmark-garbage-${process.pid}`);
|
||||||
`.removeme-benchmark-garbage-${process.pid}`);
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
dur: [5],
|
dur: [5],
|
||||||
|
@ -3,15 +3,13 @@
|
|||||||
// Yes, this is a silly benchmark. Most benchmarks are silly.
|
// Yes, this is a silly benchmark. Most benchmarks are silly.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
|
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
const filename = path.resolve(tmpdir.path,
|
const filename = tmpdir.resolve(`.removeme-benchmark-garbage-${process.pid}`);
|
||||||
`.removeme-benchmark-garbage-${process.pid}`);
|
|
||||||
let filesWritten = 0;
|
let filesWritten = 0;
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
duration: [5],
|
duration: [5],
|
||||||
|
@ -4,8 +4,7 @@ const path = require('path');
|
|||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
const benchmarkDirectory =
|
const benchmarkDirectory = tmpdir.resolve('benchmark-module-circular');
|
||||||
path.resolve(tmpdir.path, 'benchmark-module-circular');
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
n: [1e4],
|
n: [1e4],
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
const benchmarkDirectory = path.join(tmpdir.path, 'nodejs-benchmark-module');
|
const benchmarkDirectory = tmpdir.resolve('nodejs-benchmark-module');
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
ext: ['', '.js'],
|
ext: ['', '.js'],
|
||||||
|
@ -5,7 +5,7 @@ const { builtinModules } = require('module');
|
|||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
|
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
let benchmarkDirectory = path.join(tmpdir.path, 'nodejs-benchmark-module');
|
let benchmarkDirectory = tmpdir.resolve('nodejs-benchmark-module');
|
||||||
|
|
||||||
// Filter all irregular modules.
|
// Filter all irregular modules.
|
||||||
const otherModules = builtinModules.filter((name) => !/\/|^_|^sys/.test(name));
|
const otherModules = builtinModules.filter((name) => !/\/|^_|^sys/.test(name));
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
const benchmarkDirectory = path.join(tmpdir.path, 'nodejs-benchmark-module');
|
const benchmarkDirectory = tmpdir.resolve('nodejs-benchmark-module');
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
type: ['.js', '.json', 'dir'],
|
type: ['.js', '.json', 'dir'],
|
||||||
|
@ -6,12 +6,11 @@ const common = require('../common.js');
|
|||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
n: [1e5],
|
n: [1e5],
|
||||||
});
|
});
|
||||||
const path = require('path');
|
|
||||||
const { rmSync } = require('fs');
|
const { rmSync } = require('fs');
|
||||||
const { spawnSync } = require('child_process');
|
const { spawnSync } = require('child_process');
|
||||||
const tmpdir = require('../../test/common/tmpdir');
|
const tmpdir = require('../../test/common/tmpdir');
|
||||||
|
|
||||||
const coverageDir = path.join(tmpdir.path, `./cov-${Date.now()}`);
|
const coverageDir = tmpdir.resolve(`cov-${Date.now()}`);
|
||||||
|
|
||||||
function main({ n }) {
|
function main({ n }) {
|
||||||
bench.start();
|
bench.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user