-
-
Save mysticatea/fee91a313d8a201764047ee1be18f1e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/* eslint no-console: off */ | |
const fs = require("fs"); | |
const cp = require("child_process"); | |
const TEST_FILE_DATA = JSON.stringify( | |
Array.from({ length: 1024 }, () => ({ | |
aaa: Math.random(), | |
bbb: Math.random(), | |
ccc: Math.random() | |
})), | |
null, | |
4 | |
); | |
const N = 7; | |
console.log("started."); | |
const times = []; | |
for (let i = 0; i < N; ++i) { | |
fs.writeFileSync(".test.js", TEST_FILE_DATA); | |
const start = Date.now(); | |
cp.spawnSync(process.execPath, ["bin/eslint.js", "--fix", "--no-ignore", ".test.js"], { stdio: "ignore" }); | |
const time = Date.now() - start; | |
times.push(time); | |
console.log(`[${i + 1}]`, time, "ms"); | |
} | |
console.log("----------------"); | |
console.log("[#]", times.sort()[N / 2 | 0], "ms"); | |
fs.unlinkSync(".test.js"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A result: