diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js index fac331ec38ba82..e0ca7a2c1bbdbe 100644 --- a/benchmark/fs/readfile-partitioned.js +++ b/benchmark/fs/readfile-partitioned.js @@ -17,12 +17,13 @@ const zlib = require('zlib'); const assert = require('assert'); const bench = common.createBenchmark(main, { - dur: [5], + duration: [5], + encoding: ['', 'utf-8'], len: [1024, 16 * 1024 * 1024], concurrent: [1, 10] }); -function main({ len, dur, concurrent }) { +function main({ len, duration, concurrent, encoding }) { try { fs.unlinkSync(filename); } catch { @@ -47,10 +48,10 @@ function main({ len, dur, concurrent }) { } catch { // Continue regardless of error. } - }, dur * 1000); + }, duration * 1000); function read() { - fs.readFile(filename, afterRead); + fs.readFile(filename, encoding, afterRead); } function afterRead(er, data) { diff --git a/benchmark/fs/readfile-promises.js b/benchmark/fs/readfile-promises.js index 5cfa5b4cc02465..0fa92fdffad78d 100644 --- a/benchmark/fs/readfile-promises.js +++ b/benchmark/fs/readfile-promises.js @@ -15,11 +15,12 @@ const filename = path.resolve(tmpdir.path, const bench = common.createBenchmark(main, { duration: [5], + encoding: ['', 'utf-8'], len: [1024, 16 * 1024 * 1024], concurrent: [1, 10] }); -function main({ len, duration, concurrent }) { +function main({ len, duration, concurrent, encoding }) { try { fs.unlinkSync(filename); } catch { @@ -44,7 +45,7 @@ function main({ len, duration, concurrent }) { }, duration * 1000); function read() { - fs.promises.readFile(filename) + fs.promises.readFile(filename, encoding) .then((res) => afterRead(undefined, res)) .catch((err) => afterRead(err)); } diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index e27fe08f43ca86..575ceff34eb294 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -15,11 +15,12 @@ const filename = path.resolve(tmpdir.path, const bench = common.createBenchmark(main, { duration: [5], + encoding: ['', 'utf-8'], len: [1024, 16 * 1024 * 1024], concurrent: [1, 10] }); -function main({ len, duration, concurrent }) { +function main({ len, duration, concurrent, encoding }) { try { fs.unlinkSync(filename); } catch { @@ -44,7 +45,7 @@ function main({ len, duration, concurrent }) { }, duration * 1000); function read() { - fs.readFile(filename, afterRead); + fs.readFile(filename, encoding, afterRead); } function afterRead(er, data) {