eslint: Performance: ESLint is slow
I’d like to get some better information about why ESLint is so much slower than JSHint.
I added a perf test to the build, that can be run like this:
node Makefile.js perf
It runs ESLint over jshint.js. Currently it takes over 3 seconds for this test to complete. When I run JSHint on itself, it takes less than 0.5 seconds, meaning that we are six times as slow. JSCS takes just about the same as JSHint.
My hunch as to why we’re six times slower is that we’re doing multiple traversals of the AST:
- To attach comments
- To determine token ranges
- For escope
- The primary traversal that applies our rules
We need to start figuring this out.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 35 (25 by maintainers)
Commits related to this issue
- Perf: Move try-catch out of verify() function to allow V8 optimization (refs #574) — committed to eslint/eslint by nzakas 10 years ago
- Merge pull request #592 from btmills/faster-find-variable WIP: Optimize findVariable() in no-unused-vars (refs #574) — committed to eslint/eslint by nzakas 10 years ago
Yup. Ironic because that’s exactly the pull request I made to Esprima: https://github.com/ariya/esprima/pull/192
I’m going to follow up and see what it will take to get that change in.