fix(java): 尝试提升 Java 查找速度#3152
Conversation
缩小了搜索深度,并进一步框定扫描范围
Reviewer's Guide此 PR 通过减少搜索深度、收紧默认根目录(尤其是 %APPDATA% 下的路径),并优化 BFS 目录遍历逻辑,使其仅向下进入看起来与 Java 相关或类似版本号的目录,同时修复了 Java 关键字常量中的拼写错误,从而收紧了 Java 运行时扫描逻辑。 更新后的 Java 运行时 BFS 扫描流程图flowchart TD
A[Start _BfsSearch] --> B[Dequeue current, depth]
B --> C{depth > MaxSearchDepth}
C -->|Yes| D[Skip directory]
C -->|No| E[EnumerateDirectories current]
E --> F[For each subDir]
F --> G[Combine subDir + java.exe]
G --> H{File.Exists javaExe}
H -->|Yes| I[results.Add javaExe]
I --> F
H -->|No| J{_ShouldExploreDeeper subDir}
J -->|Yes| K[queue.Enqueue subDir, depth+1]
J -->|No| F
D --> L[End when queue empty]
K --> F
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideThis PR tightens the Java runtime scanning logic by reducing search depth, constraining default roots (especially under %APPDATA%), and refining BFS directory traversal to only descend into directories that look Java-related or version-like, while also fixing a typo in the Java keyword constants. Flow diagram for updated Java runtime BFS scanningflowchart TD
A[Start _BfsSearch] --> B[Dequeue current, depth]
B --> C{depth > MaxSearchDepth}
C -->|Yes| D[Skip directory]
C -->|No| E[EnumerateDirectories current]
E --> F[For each subDir]
F --> G[Combine subDir + java.exe]
G --> H{File.Exists javaExe}
H -->|Yes| I[results.Add javaExe]
I --> F
H -->|No| J{_ShouldExploreDeeper subDir}
J -->|Yes| K[queue.Enqueue subDir, depth+1]
J -->|No| F
D --> L[End when queue empty]
K --> F
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我已经审阅了你的更改,一切看起来都很棒!
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2671bb2897
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a30bc400ed
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
感觉这里的性能热点应该是阻塞服务加载流程而不是搜索范围过大导致的,这样做应该算是治标不治本? |
你说的对 流程应该也得改改 但这留给另一个 PR 吧 |
缩小了搜索深度,并进一步框定扫描范围
Resolved #3134
Summary by Sourcery
提高 Java 运行时扫描性能,并缩小查找
java.exe安装位置时的搜索范围。改进内容:
Original summary in English
Summary by Sourcery
Improve Java runtime scanning performance and narrow the search scope for locating java.exe installations.
Enhancements: