eslint: Extremely slow with antivirus
The company I work for requires that I run some horrible (but somehow popular) antivirus software on my PC which makes my eslint .
take nearly 30 seconds to run on a very small project.
I did a little investigating and all of that slowness occurs in glob-util.js
in the call to glob.sync(pattern, globOptions)
. If I modify globOptions to include ignore: 'node_modules/**'
my linting drops to one second.
It appears that crawling node_modules causes my antivirus to kick in for each file, and I’m assuming I can’t be the only one with this problem. In any case, filtering out node_modules before the glob.sync call should certainly speed things up to some degree for everyone.
I understand that there is some complex logic involved with ignoring and unignoring paths so I see why all node_modules paths are included at this point in the code, but is there a chance this could be handled in some other way that would short-circuit the needless crawling? It would be a massive 99% speed increase, at least for me and anyone else in my position.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 43 (24 by maintainers)
Commits related to this issue
- eslint: Manually skip ignored directories eslint's ignore system first gathers a list of all files, then decides which ones should be ignored. The "gather a list of all files" runs out of memory when... — committed to smogon/pokemon-showdown by Zarel 8 years ago
- Update from main (#123) * Report Return/Frustration's base power * Add new events * Endless Battle: Fix Trick detection * Support /ME in PMs Will act like /me except also capitalize the u... — committed to jaredgrady/Origin by deleted user 8 years ago
- Fix: Massive perf win when linting without folders. By passing the ignore options directly to glob instead of filtering the files inside of eslint we see a *significant* perf boost. (fixes #5679) — committed to samccone/eslint by samccone 8 years ago
- Fix: Massive perf win when linting without folders. (fixes #5679) By passing the ignore options directly to glob instead of filtering the files inside of eslint we see a *significant* perf boost. — committed to samccone/eslint by samccone 8 years ago
- Update: Improve perf not traversing default ignored dirs (fixes #5679) — committed to eslint/eslint by alberto 8 years ago
- Update: Improve perf not traversing default ignored dirs (fixes #5679) — committed to eslint/eslint by alberto 8 years ago
- Update: Improve perf not traversing default ignored dirs (fixes #5679) — committed to eslint/eslint by alberto 8 years ago
- Fix: Improves performance of globbing with large amount of files by specifying ignore patterns (fixes #5679) — committed to kaelzhang/eslint by deleted user 8 years ago
- Fix: Improves performance of globbing with large amount of files by specifying ignore patterns (fixes #5679) — committed to kaelzhang/eslint by deleted user 8 years ago
- Fix: Improves performance of globbing with large amount of files by specifying ignore patterns (fixes #5679) — committed to kaelzhang/eslint by deleted user 8 years ago
From the looks of it this could be a huge performance improvement. Provided nobody else wants to solve it in the near future, I’ll take a look at it until the end of the week.
This doesn’t solve my own problem, which is that the huge ignored directory is
logs/
, notnode_modules/
…I’m working on a simple fix for this just for the default ignores, as mentioned here
@IanVS We could also do some fuzzy logic and avoid crawling
node_modules
andbower_components
if either:--ignore-pattern
node_modules
orbower_components
I’d really rather not add any more ignore-related flags if we can avoid it.
I understand that node_modules is ignored by default, but
glob.sync(pattern, globOptions)
happens before ignoredPaths rules are applied. My question is whether or not node_modules can be excluded from the glob crawling instead of each file under node_modules being filtered out one-by-one after the fact.I’m using 2.5.0, but this was also an issue in 2.4.0.