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

upgrade 3.19 to 4.3.0 - no-multi-spaces - incredibly slow #9001

Closed
jzastrow opened this issue Jul 25, 2017 · 2 comments
Closed

upgrade 3.19 to 4.3.0 - no-multi-spaces - incredibly slow #9001

jzastrow opened this issue Jul 25, 2017 · 2 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@jzastrow
Copy link

Rule                     |  Time (ms) | Relative
:------------------------|-----------:|--------:
no-multi-spaces          | 128895.239 |    98.8%
indent                   |    572.412 |     0.4%
comma-style              |     87.177 |     0.1%
comma-spacing            |     62.077 |     0.0%
no-regex-spaces          |     51.506 |     0.0%
keyword-spacing          |     50.365 |     0.0%
mocha/no-identical-title |     47.103 |     0.0%
no-control-regex         |     42.972 |     0.0%
key-spacing              |     41.282 |     0.0%
no-useless-escape        |     38.029 |     0.0%

Tell us about your environment

  • ESLint Version:4.3
  • Node Version:8.1.4
  • npm Version:5.3.0

What parser (default, Babel-ESLint, etc.) are you using?

Please show your full configuration:

{
  "root": true,
  "extends": "eslint:recommended",

  "rules": {

    "curly": ["error", "all"],
    "eqeqeq": "error",
    "no-eq-null": "error",
    "vars-on-top": "error",
    "wrap-iife": ["error", "any"],
    "max-params": ["warn", { "max": 5 }],
    "no-console": "error",
    "no-unused-vars": ["error", {
      "vars": "all",
      "args": "none"
    }],
    "semi": ["error", "always"],


    // Structure

    "block-spacing": ["warn", "always"],
    "brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
    "comma-dangle": ["warn", "only-multiline"],
    "comma-spacing": ["warn", { "before": false, "after": true }],
    "comma-style": ["warn", "last"],
    "dot-location": ["warn", "property"],
    "indent": ["warn", "tab"],
    "key-spacing": ["warn", {
      "beforeColon": false,
      "afterColon": true,
      "mode": "minimum"
    }],
    "keyword-spacing": ["warn", { "before": true, "after": true }],
    "linebreak-style": ["warn", "unix"],
    "quotes": ["warn", "double", "avoid-escape"],
    "space-infix-ops": "warn",
    "space-unary-ops": ["warn", { "words": true, "nonwords": false }],


    // Other whitespace

    "eol-last": ["warn", "unix"],
    "newline-after-var": ["warn", "always"],
    "newline-before-return": "warn",
    "no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
    "no-multiple-empty-lines": ["warn", { "max": 2 }],
    "no-multi-spaces": ["warn"],
    "no-trailing-spaces": ["warn", { "skipBlankLines": true }],
    "padded-blocks": [0, "never"],
    "space-before-blocks": ["warn", "always"],
    "space-before-function-paren": ["warn", { "anonymous": "always", "named": "never" }],
    "space-in-parens": ["warn", "never"],
    "spaced-comment": ["warn", "always"],


    // Misc

    "valid-jsdoc": ["warn", {
      "prefer": {
        "return": "returns"
      },
      "requireReturn": false,
      "requireReturnDescription": false
    }],

	"mocha/no-exclusive-tests": "error",
	"mocha/no-identical-title": "error"
  },

  "parserOptions": {
	"ecmaVersion": 8,
	"sourceType": "module",
	"ecmaFeatures": {
	  "experimentalObjectRestSpread": true
	}
  },

  "env": {
    "node": true
  },

  "globals" : {
    "Promise": true
  },

  "plugins": [
	"mocha"
  ]
}
Configuration

What did you do? Please include the actual source code causing the issue.

eslint src test

What did you expect to happen?

As with eslint 3.19 completing within few seconds

What actually happened? Please include the actual, raw output from ESLint.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 25, 2017
@not-an-aardvark
Copy link
Member

Thanks for the report. Do you have an example of source code that causes this issue?

One potential way to find the file would be to run

eslint --debug src test

You'll get a bunch of debug messages as ESLint runs on each file. I suspect the problem is only occurring in a particular file, so if the debug messages stop printing for more than a few seconds, you can see which file is taking a long time to lint.

@not-an-aardvark not-an-aardvark added bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jul 25, 2017
@not-an-aardvark
Copy link
Member

Never mind, I figured out the problem. The rule takes 17 seconds to run if the source code is the letter a repeated 200000 times.

$ time node -e 'console.log("a".repeat(200000))' | bin/eslint.js --stdin --no-eslintrc --rule='no-multi-spaces:error'

real	0m17.572s
user	0m17.536s
sys	0m0.110s

Looks like there's a backtracking issue in this regex that causes it to take quadratic time with regard to the maximum line length of a file.

Out of interest, are you running ESLint on minified code? I think this would only be noticeable when there's a line that contains more than 50000 characters or so.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 25, 2017
@not-an-aardvark not-an-aardvark self-assigned this Jul 26, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants