Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter: use async I/O for greater speed #16572

Closed
bershanskiy opened this issue Jun 7, 2022 · 1 comment · Fixed by #16624
Closed

Linter: use async I/O for greater speed #16572

bershanskiy opened this issue Jun 7, 2022 · 1 comment · Fixed by #16624
Labels
linter Issues or pull requests regarding the tests / linter of the JSON files.

Comments

@bershanskiy
Copy link
Contributor

#16437 introduced a new linter which unfortunately uses only synchronous I/O: existsSync, existsSync (multiple times on the same file!), readFileSync, readdirSync.

if (!fs.existsSync(file)) {

if (fs.statSync(file).isFile() && path.extname(file) === '.json') {

const rawFileData = fs.readFileSync(file, 'utf-8').trim();

if (fs.statSync(file).isDirectory()) {

.readdirSync(file)

This makes linter very slow, on a decent laptop with an SSD time npm run lint produces:

real    0m8.531s
user    0m0.046s
sys     0m0.106s

I like async I/O a lot and if you would be interested in reviewing a PR for async I/O, I can create one.

@queengooborg queengooborg added the linter Issues or pull requests regarding the tests / linter of the JSON files. label Jun 7, 2022
@queengooborg
Copy link
Contributor

The linter has actually not been asynchronous before! I'm totally down for making it asynchronous though to speed it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linter Issues or pull requests regarding the tests / linter of the JSON files.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants