-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Performance] no-cycle
: dont scc for each linted file
#3068
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3068 +/- ##
==========================================
+ Coverage 92.21% 94.37% +2.16%
==========================================
Files 82 82
Lines 3557 3558 +1
Branches 1244 1243 -1
==========================================
+ Hits 3280 3358 +78
+ Misses 277 200 -77
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I ran this vs master on a large project and measured: Without this change (v2.30.0): 139 seconds to lint just |
Pushed a fix for false cache hit for when I ran this vs master on a large project and measured: Without this change (v2.30.0): 139 seconds to lint just no-cycle Still good IMO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, assuming that there's nothing else in the context that might necessitate a fresh scc, including with all the parsers we support. Can you confirm?
@ljharb in Discord you asked me:
You also said
Ok, I logged the ESLint 7.25.0: {
"cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd9da56ee23e751184e57ead488db4381bbe0f9fdc987aa0e7c39a448ea5986827e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts",
"settings": {
"import/extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
],
"import/external-module-folders": [
"node_modules",
"node_modules/@types"
],
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".cts",
".mts",
".tsx"
]
},
"import/resolver": {
"node": {
"extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
]
}
}
},
"parserOptions": {
"ecmaFeatures": {
"globalReturn": false
},
"project": "tsconfig.json",
"sourceType": "module"
},
"parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js",
"path": "/path-to-somewhere/src/main.ts"
} ESLint 6.8.0: {
"cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd9da56ee23e751184e57ead488db4381bbe0f9fdc987aa0e7c39a448ea5986827e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts",
"settings": {
"import/extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
],
"import/external-module-folders": [
"node_modules",
"node_modules/@types"
],
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".cts",
".mts",
".tsx"
]
},
"import/resolver": {
"node": {
"extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
]
}
}
},
"parserOptions": {
"ecmaFeatures": {
"globalReturn": false
},
"project": "tsconfig.json",
"sourceType": "module"
},
"parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js",
"path": "/path-to-somewhere/src/main.ts"
} ESLint 5.16.0: {
"cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd579e5a92f2fb830c4066e8075b30bdff66e6bb3eafbbfe9dc70dc8ec7c603f47e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts",
"settings": {
"import/extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
],
"import/external-module-folders": [
"node_modules",
"node_modules/@types"
],
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".cts",
".mts",
".tsx"
]
},
"import/resolver": {
"node": {
"extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
]
}
}
},
"parserOptions": {
"ecmaFeatures": {
"globalReturn": false
},
"project": "tsconfig.json",
"sourceType": "module",
"ecmaVersion": 6
},
"parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js",
"path": "/path-to-somewhere/src/main.ts"
} ESLint 4.19.1: {
"cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd579e5a92f2fb830c4066e8075b30bdff66e6bb3eafbbfe9dc70dc8ec7c603f47e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts",
"settings": {
"import/extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
],
"import/external-module-folders": [
"node_modules",
"node_modules/@types"
],
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".cts",
".mts",
".tsx"
]
},
"import/resolver": {
"node": {
"extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
]
}
}
},
"parserOptions": {
"ecmaFeatures": {
"globalReturn": false
},
"project": "tsconfig.json",
"sourceType": "module",
"ecmaVersion": 6
},
"parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js",
"path": "/path-to-somewhere/src/main.ts"
} ESLint 3.19.0: {
"cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd579e5a92f2fb830c4066e8075b30bdff66e6bb3eafbbfe9dc70dc8ec7c603f47e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts",
"settings": {
"import/extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
],
"import/external-module-folders": [
"node_modules",
"node_modules/@types"
],
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".cts",
".mts",
".tsx"
]
},
"import/resolver": {
"node": {
"extensions": [
".ts",
".cts",
".mts",
".tsx",
".js",
".jsx",
".mjs",
".cjs"
]
}
}
},
"parserOptions": {
"ecmaFeatures": {
"globalReturn": false
},
"project": "tsconfig.json",
"sourceType": "module",
"ecmaVersion": 6
},
"parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js",
"path": "/path-to-somewhere/src/main.ts"
} For ESLint 2 I got:
In summary, I believe that yes that's all that interests us in the |
d0e4752
to
f1db531
Compare
no-cycle
: dont scc for each linted file
| datasource | package | from | to | | ---------- | -------------------- | ------ | ------ | | npm | eslint-plugin-import | 2.30.0 | 2.31.0 | ## [v2.31.0](https://github.com/import-js/eslint-plugin-import/blob/HEAD/CHANGELOG.md#2310---2024-10-03) ##### Added - support eslint v9 (\[[#2996](import-js/eslint-plugin-import#2996)], thanks \[[@G-Rath](https://github.com/G-Rath)] \[[@michaelfaith](https://github.com/michaelfaith)]) - \[`order`]: allow validating named imports (\[[#3043](import-js/eslint-plugin-import#3043)], thanks \[[@manuth](https://github.com/manuth)]) - \[`extensions`]: add the `checkTypeImports` option (\[[#2817](import-js/eslint-plugin-import#2817)], thanks \[[@phryneas](https://github.com/phryneas)]) ##### Fixed - `ExportMap` / flat config: include `languageOptions` in context (\[[#3052](import-js/eslint-plugin-import#3052)], thanks \[[@michaelfaith](https://github.com/michaelfaith)]) - \[`no-named-as-default`]: Allow using an identifier if the export is both a named and a default export (\[[#3032](import-js/eslint-plugin-import#3032)], thanks \[[@akwodkiewicz](https://github.com/akwodkiewicz)]) - \[`export`]: False positive for exported overloaded functions in TS (\[[#3065](import-js/eslint-plugin-import#3065)], thanks \[[@liuxingbaoyu](https://github.com/liuxingbaoyu)]) - `exportMap`: export map cache is tainted by unreliable parse results (\[[#3062](import-js/eslint-plugin-import#3062)], thanks \[[@michaelfaith](https://github.com/michaelfaith)]) - `exportMap`: improve cacheKey when using flat config (\[[#3072](import-js/eslint-plugin-import#3072)], thanks \[[@michaelfaith](https://github.com/michaelfaith)]) - adjust "is source type module" checks for flat config (\[[#2996](import-js/eslint-plugin-import#2996)], thanks \[[@G-Rath](https://github.com/G-Rath)]) ##### Changed - \[Docs] \[`no-relative-packages`]: fix typo (\[[#3066](import-js/eslint-plugin-import#3066)], thanks \[[@joshuaobrien](https://github.com/joshuaobrien)]) - \[Performance] \[`no-cycle`]: dont scc for each linted file (\[[#3068](import-js/eslint-plugin-import#3068)], thanks \[[@soryy708](https://github.com/soryy708)]) - \[Docs] \[`no-cycle`]: add `disableScc` to docs (\[[#3070](import-js/eslint-plugin-import#3070)], thanks \[[@soryy708](https://github.com/soryy708)]) - \[Tests] use re-exported `RuleTester` (\[[#3071](import-js/eslint-plugin-import#3071)], thanks \[[@G-Rath](https://github.com/G-Rath)]) - \[Docs] \[`no-restricted-paths`]: fix grammar (\[[#3073](import-js/eslint-plugin-import#3073)], thanks \[[@unbeauvoyage](https://github.com/unbeauvoyage)]) - \[Tests] \[`no-default-export`], \[`no-named-export`]: add test case (thanks \[[@G-Rath](https://github.com/G-Rath)])
| datasource | package | from | to | | ---------- | -------------------- | ------ | ------ | | npm | eslint-plugin-import | 2.30.0 | 2.31.0 | ## [v2.31.0](https://github.com/import-js/eslint-plugin-import/blob/HEAD/CHANGELOG.md#2310---2024-10-03) ##### Added - support eslint v9 (\[[#2996](import-js/eslint-plugin-import#2996)], thanks \[[@G-Rath](https://github.com/G-Rath)] \[[@michaelfaith](https://github.com/michaelfaith)]) - \[`order`]: allow validating named imports (\[[#3043](import-js/eslint-plugin-import#3043)], thanks \[[@manuth](https://github.com/manuth)]) - \[`extensions`]: add the `checkTypeImports` option (\[[#2817](import-js/eslint-plugin-import#2817)], thanks \[[@phryneas](https://github.com/phryneas)]) ##### Fixed - `ExportMap` / flat config: include `languageOptions` in context (\[[#3052](import-js/eslint-plugin-import#3052)], thanks \[[@michaelfaith](https://github.com/michaelfaith)]) - \[`no-named-as-default`]: Allow using an identifier if the export is both a named and a default export (\[[#3032](import-js/eslint-plugin-import#3032)], thanks \[[@akwodkiewicz](https://github.com/akwodkiewicz)]) - \[`export`]: False positive for exported overloaded functions in TS (\[[#3065](import-js/eslint-plugin-import#3065)], thanks \[[@liuxingbaoyu](https://github.com/liuxingbaoyu)]) - `exportMap`: export map cache is tainted by unreliable parse results (\[[#3062](import-js/eslint-plugin-import#3062)], thanks \[[@michaelfaith](https://github.com/michaelfaith)]) - `exportMap`: improve cacheKey when using flat config (\[[#3072](import-js/eslint-plugin-import#3072)], thanks \[[@michaelfaith](https://github.com/michaelfaith)]) - adjust "is source type module" checks for flat config (\[[#2996](import-js/eslint-plugin-import#2996)], thanks \[[@G-Rath](https://github.com/G-Rath)]) ##### Changed - \[Docs] \[`no-relative-packages`]: fix typo (\[[#3066](import-js/eslint-plugin-import#3066)], thanks \[[@joshuaobrien](https://github.com/joshuaobrien)]) - \[Performance] \[`no-cycle`]: dont scc for each linted file (\[[#3068](import-js/eslint-plugin-import#3068)], thanks \[[@soryy708](https://github.com/soryy708)]) - \[Docs] \[`no-cycle`]: add `disableScc` to docs (\[[#3070](import-js/eslint-plugin-import#3070)], thanks \[[@soryy708](https://github.com/soryy708)]) - \[Tests] use re-exported `RuleTester` (\[[#3071](import-js/eslint-plugin-import#3071)], thanks \[[@G-Rath](https://github.com/G-Rath)]) - \[Docs] \[`no-restricted-paths`]: fix grammar (\[[#3073](import-js/eslint-plugin-import#3073)], thanks \[[@unbeauvoyage](https://github.com/unbeauvoyage)]) - \[Tests] \[`no-default-export`], \[`no-named-export`]: add test case (thanks \[[@G-Rath](https://github.com/G-Rath)])
I noticed that
no-cycle
has a cache miss on SCC very often,turns out that each linted file builds its own SCC, which is unnecessary.
Lets speed things up, by using the already cached SCC, as long as the context is similar (excluding linted file path)