Skip to content

Commit 047b191

Browse files
conooigemini-code-assist[bot]parlough
authored
Add analyzer performance page (#7020)
Add Analyzer performance page. Resolves #6924 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Parker Lougheed <[email protected]>
1 parent 0b4eb9d commit 047b191

File tree

4 files changed

+117
-1
lines changed

4 files changed

+117
-1
lines changed

site/lib/src/style_hash.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// dart format off
33

44
/// The generated hash of the `main.css` file.
5-
const generatedStylesHash = 'yDmRCh8GrQiX';
5+
const generatedStylesHash = 'X6ZbnMpWSdwu';

src/content/tools/analysis.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ Use the following resources to learn more about static analysis in Dart:
657657
* [Dart's type system][type-system]
658658
* [Dart linter rules][linter rules]
659659
* [analyzer package]({{site.pub-pkg}}/analyzer)
660+
* [Troubleshoot analyzer performance][]
660661

661662
[invalid_null_aware_operator]: /tools/diagnostic-messages#invalid_null_aware_operator
662663
[analyzer diagnostics]: /tools/diagnostic-messages
@@ -671,3 +672,4 @@ Use the following resources to learn more about static analysis in Dart:
671672
[Effective Dart]: /effective-dart
672673
[`dart format`]: /tools/dart-format
673674
[Configuring formatter page width]: /tools/dart-format#configuring-formatter-page-width
675+
[Troubleshoot analyzer performance]: /tools/analyzer-performance
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: Troubleshoot analyzer performance
3+
description: >-
4+
Learn how to diagnose and resolve common
5+
Dart analysis server performance issues.
6+
---
7+
8+
This guide helps you diagnose and resolve common Dart analysis server
9+
performance issues in your Dart or Flutter IDE.
10+
11+
## Known performance issues
12+
13+
Several common issues significantly hurt the performance of
14+
the Dart analysis server (the analyzer).
15+
Check the following issues to see if they might be impacting
16+
your development environment.
17+
18+
### Security software on Windows
19+
20+
On Windows systems, if Windows Defender (or other real-time security software)
21+
is enabled, it can slow down the file read times enough
22+
to impact analyzer performance. The analyzer frequently reads files,
23+
and constant scanning can introduce latency. To mitigate this,
24+
you can set up exclusions for the directories the analyzer reads from.
25+
26+
:::warning
27+
Excluding directories from security scans might diminish the
28+
protection that your antivirus software provides.
29+
Proceed with caution.
30+
:::
31+
32+
If you choose to set up exclusions, include the following directories:
33+
34+
* The analysis server's cache directory: `%LOCALAPPDATA%\.dartServer`
35+
* The directory for packages downloaded by pub: `%LOCALAPPDATA%\Pub\Cache`
36+
* Any other directories containing code for your applications.
37+
38+
For another way to improve file I/O performance,
39+
consider setting up a [dev drive][].
40+
41+
### Symbolic links
42+
43+
If your package directory contains symbolic links that point
44+
to a location inside the same directory, or to a parent directory,
45+
you might experience performance problems with Dart tooling (like the analyzer).
46+
47+
**Status:** The Dart team is actively working on a fix for this issue.
48+
49+
**Workaround:** There are no known workarounds at this time.
50+
51+
## Report unknown issues
52+
53+
If the known issues don't seem to apply to your situation,
54+
please open an issue in the [Dart SDK issue tracker][].
55+
The more information you provide,
56+
the faster the team can diagnose and fix the problem.
57+
58+
### Include reproduction steps
59+
60+
In your issue, please provide detailed steps to
61+
reproduce the behavior you're observing.
62+
63+
1. If you're working on an open-source project, include instructions
64+
for downloading the code.
65+
2. If you can't share your code, create a small, self-contained reproduction case.
66+
3. If you can't provide either, please state that in the issue.
67+
68+
### Provide performance data
69+
70+
If the issue is related to performance, providing performance data
71+
can be very helpful. You can collect this data using the
72+
analysis server's diagnostic pages:
73+
74+
1. **Open the Analyzer Diagnostics page:**
75+
* **If you are using VS Code:**
76+
1. Click **View > Command Palette**.
77+
2. Type `Dart: Open Analyzer Diagnostics` and select it.
78+
* **If you are using IntelliJ / Android Studio:**
79+
1. Open the **Dart Analysis** tool window.
80+
2. Click the settings icon, and then select **View analyzer diagnostics**.
81+
2. **Collect the report:**
82+
1. In the browser page that opens, click **Collect Report** in the top banner.
83+
2. Perform the actions that trigger the slow behavior.
84+
3. Click the **Download report** link.
85+
3. **Attach the report to your issue.**
86+
87+
:::note
88+
While the report shouldn't contain
89+
personal or proprietary information,
90+
review it before submitting it.
91+
:::
92+
93+
### Capture instrumentation logs
94+
95+
In some cases, instrumentation logs can provide additional
96+
details for diagnosing issues.
97+
98+
To capture these logs:
99+
100+
* **VS Code:** Follow the instructions for
101+
[capturing analyzer instrumentation logs][].
102+
* **IntelliJ / Android Studio:** Follow the
103+
[analyzer instrumentation instructions][].
104+
105+
Before attaching logs to a GitHub issue, review them carefully
106+
to ensure they do not contain any personal, sensitive, or proprietary
107+
information.
108+
109+
[dev drive]: https://learn.microsoft.com/windows/dev-drive/
110+
[Dart SDK issue tracker]: https://github.com/dart-lang/sdk/issues
111+
[capturing analyzer instrumentation logs]: https://dartcode.org/docs/logging/#analyzer-instrumentation
112+
[analyzer instrumentation instructions]: https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/doc/tutorial/instrumentation.md#intellij-idea-and-android-studio

src/data/sidenav/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@
271271
permalink: /tools/jetbrains-plugin
272272
- title: VS Code
273273
permalink: /tools/vs-code
274+
- title: Troubleshoot analyzer performance
275+
permalink: /tools/analyzer-performance
274276
- title: Dart DevTools
275277
permalink: /tools/dart-devtools
276278
- title: DartPad

0 commit comments

Comments
 (0)