| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,12 +17,13 @@ const zlib = require('zlib'); | |||
| 17 | 17 | const assert = require('assert'); | |
| 18 | 18 | ||
| 19 | 19 | const bench = common.createBenchmark(main, { | |
| 20 | - dur: [5], | ||
| 20 | + duration: [5], | ||
| 21 | + encoding: ['', 'utf-8'], | ||
| 21 | 22 | len: [1024, 16 * 1024 * 1024], | |
| 22 | 23 | concurrent: [1, 10] | |
| 23 | 24 | }); | |
| 24 | 25 | ||
| 25 | - function main({ len, dur, concurrent }) { | ||
| 26 | + function main({ len, duration, concurrent, encoding }) { | ||
| 26 | 27 | try { | |
| 27 | 28 | fs.unlinkSync(filename); | |
| 28 | 29 | } catch { | |
@@ -47,10 +48,10 @@ function main({ len, dur, concurrent }) { | |||
| 47 | 48 | } catch { | |
| 48 | 49 | // Continue regardless of error. | |
| 49 | 50 | } | |
| 50 | - }, dur * 1000); | ||
| 51 | + }, duration * 1000); | ||
| 51 | 52 | ||
| 52 | 53 | function read() { | |
| 53 | - fs.readFile(filename, afterRead); | ||
| 54 | + fs.readFile(filename, encoding, afterRead); | ||
| 54 | 55 | } | |
| 55 | 56 | ||
| 56 | 57 | function afterRead(er, data) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,11 +15,12 @@ const filename = path.resolve(tmpdir.path, | |||
| 15 | 15 | ||
| 16 | 16 | const bench = common.createBenchmark(main, { | |
| 17 | 17 | duration: [5], | |
| 18 | + encoding: ['', 'utf-8'], | ||
| 18 | 19 | len: [1024, 16 * 1024 * 1024], | |
| 19 | 20 | concurrent: [1, 10] | |
| 20 | 21 | }); | |
| 21 | 22 | ||
| 22 | - function main({ len, duration, concurrent }) { | ||
| 23 | + function main({ len, duration, concurrent, encoding }) { | ||
| 23 | 24 | try { | |
| 24 | 25 | fs.unlinkSync(filename); | |
| 25 | 26 | } catch { | |
@@ -44,7 +45,7 @@ function main({ len, duration, concurrent }) { | |||
| 44 | 45 | }, duration * 1000); | |
| 45 | 46 | ||
| 46 | 47 | function read() { | |
| 47 | - fs.promises.readFile(filename) | ||
| 48 | + fs.promises.readFile(filename, encoding) | ||
| 48 | 49 | .then((res) => afterRead(undefined, res)) | |
| 49 | 50 | .catch((err) => afterRead(err)); | |
| 50 | 51 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,11 +15,12 @@ const filename = path.resolve(tmpdir.path, | |||
| 15 | 15 | ||
| 16 | 16 | const bench = common.createBenchmark(main, { | |
| 17 | 17 | duration: [5], | |
| 18 | + encoding: ['', 'utf-8'], | ||
| 18 | 19 | len: [1024, 16 * 1024 * 1024], | |
| 19 | 20 | concurrent: [1, 10] | |
| 20 | 21 | }); | |
| 21 | 22 | ||
| 22 | - function main({ len, duration, concurrent }) { | ||
| 23 | + function main({ len, duration, concurrent, encoding }) { | ||
| 23 | 24 | try { | |
| 24 | 25 | fs.unlinkSync(filename); | |
| 25 | 26 | } catch { | |
@@ -44,7 +45,7 @@ function main({ len, duration, concurrent }) { | |||
| 44 | 45 | }, duration * 1000); | |
| 45 | 46 | ||
| 46 | 47 | function read() { | |
| 47 | - fs.readFile(filename, afterRead); | ||
| 48 | + fs.readFile(filename, encoding, afterRead); | ||
| 48 | 49 | } | |
| 49 | 50 | ||
| 50 | 51 | function afterRead(er, data) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments