Skip to content

[no-implied-eval] Potential earlier exit for increased performance on large projects #4286

Closed
@mikeauclair

Description

@mikeauclair

When running eslint, @typescript-eslint/no-implied-eval is (unexpectedly) the plurality of our runtime. In lifting the early exit up to the beginning of the function here https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/no-implied-eval.ts#L138-L144 in the version installed in our node_modules dir performance is increased greatly (results in actual / expected below). I'm willing to PR this change if this sounds like a plausible issue, but I don't have a great understanding of what root cause could be here as of yet, just that an earlier exit seems to help.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro
This issue doesn't seem to surface in the minimal case (smaller slices of our application don't have no-implied-eval trump prettier in runtime), so it's near-impossible to provide a minimal repro case. This could be due to cache growth somewhere?

{
  "rules": {
    "@typescript-eslint/no-implied-eval": ["error"],
  }
}

Expected Result
A timing blend along the lines of:

Rule                                 | Time (ms) | Relative
:------------------------------------|----------:|--------:
prettier/prettier                    | 37671.679 |    41.0%
import/no-duplicates                 | 18799.573 |    20.5%
@typescript-eslint/no-implied-eval   |  7390.961 |     8.0%
react/no-string-refs                 |  6424.481 |     7.0%
import/order                         |  4490.649 |     4.9%
compat/compat                        |  4415.710 |     4.8%
jsdoc/check-alignment                |  2617.101 |     2.8%
jsdoc/check-indentation              |  1500.595 |     1.6%
jsdoc/newline-after-description      |  1500.423 |     1.6%
@typescript-eslint/naming-convention |  1214.155 |     1.3%

Actual Result

Rule                                 | Time (ms) | Relative
:------------------------------------|----------:|--------:
@typescript-eslint/no-implied-eval   | 65356.175 |    35.6%
prettier/prettier                    | 51318.756 |    28.0%
import/no-duplicates                 | 27946.578 |    15.2%
react/no-string-refs                 |  8523.883 |     4.6%
compat/compat                        |  6618.511 |     3.6%
import/order                         |  5727.805 |     3.1%
jsdoc/check-alignment                |  3421.487 |     1.9%
jsdoc/newline-after-description      |  2177.228 |     1.2%
jsdoc/check-indentation              |  2131.201 |     1.2%
@typescript-eslint/naming-convention |  1679.087 |     0.9%

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 5.6.0
@typescript-eslint/parser 5.6.0
TypeScript 4.5.0
ESLint 8.4.1
node 16.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginperformanceIssues regarding performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions