-
-
Save mysticatea/ea067fcf82b322a876ca358dbcc12413 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 { CLIEngine } = require("./lib/api"); | |
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 = []; | |
const engine = new CLIEngine({ fix: true, ignore: false }); | |
for (let i = 0; i < N; ++i) { | |
fs.writeFileSync(".test.js", TEST_FILE_DATA); | |
const start = Date.now(); | |
engine.executeOnFiles([".test.js"]); | |
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: