Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Performance Opportunities#6366
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I just wanted to have a publicly visible, centralised list of these somewhere that I can easily reference and add to without having to file an in-depth issue straight away. Parsing
CLI Runs ("one-and-done" runs)
IDE Runs ("persistent" runs)
Rules
|
BetaWas this translation helpful?Give feedback.
All reactions
🚀 5
Replies: 2 comments
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
It's worth mentioning that we can and should leverage CPU profiling more in our investigations. $node--cpu-prof./node_modules/.bin/eslint. or you can isolate to a specific lint rule: $node--cpu-prof./node_modules/.bin/eslint--no-eslintrc--parser="@typescript-eslint/parser"--plugin"@typescript-eslint"--rule"@typescript-eslint/no-unused-vars: [error]"--ext=".ts,.tsx". or with a slightly more complicated config in a new config file like: $touch.temp.eslintrc.js#editfile$node--cpu-prof./node_modules/.bin/eslint--no-eslintrc-c.temp.eslintrcjs. This will generate a I've found that switching the graph to "left heavy" mode is best for holistically analysing the performance. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Took a CPU profile off of the latest v8 commit (56ef573):
CPU.20240728.151034.53658.0.001.cpuprofile.zip At a glance we can quickly see:
Of that parse time - most of it is spent within TS's functions -- ~20% (~2.9s) of it is spent in our Here are some disorganised notes from poking through the profile: It's easy to see that we spend a whole lot of time in TS's APIs across rules. There's probably some opportunities here to make our rules use TS's APIs less (eg by answering more questions with the AST ahead of time). In our codebase the biggest rule is our internal plugin formatting rule - which is understandable considering it uses prettier to check each and every test case in the codebase to ensure it's formatting. Let's ignore that for now as well. The second biggest block of time is spent in Looking at the code the function is specifically looking for cases like First if the variable doesn't have an annotation - then the type of the variable will be the type of the initialiser so the case is impossible. Simply exiting early if Second there's a number of types we can detect syntactically and we can guarantee are never function types. For example #9656 is the result of adding these checks, and this is the resulting profile: Sadly we can see the impact of what I mentioned above - even though we've managed to reduce the time spent in That being said it's still a good thing to do! If we can do this everywhere then we can slowly move the needle and reduce the cost of the lint run. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 5