Skip to content

perf: 缓存 ConfigManager 反射属性元数据并添加线程安全保护#121

Merged
Akiha-Official merged 1 commit into
DoomVoss:mainfrom
ABA2396:perf/cache-config-properties
Jun 30, 2026
Merged

perf: 缓存 ConfigManager 反射属性元数据并添加线程安全保护#121
Akiha-Official merged 1 commit into
DoomVoss:mainfrom
ABA2396:perf/cache-config-properties

Conversation

@ABA2396

@ABA2396 ABA2396 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 27, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在优化 ConfigManager.Save() 的性能与并发安全:通过缓存反射获取的属性元数据,并在读写配置/配置档案(profiles)时添加同步保护,减少重复反射与潜在并发读写问题。

Changes:

  • 引入属性元数据缓存(避免 Save() 每次反射查找属性)。
  • Save()、profiles 读写、重置流程增加锁,提升并发访问安全性。
  • GetProfiles() 改为返回拷贝,避免外部直接修改内部集合。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ConfigManager.cs
Comment thread src/ConfigManager.cs
@DoomVoss DoomVoss requested a review from Akiha-Official June 30, 2026 06:41
@Akiha-Official Akiha-Official merged commit 5930e61 into DoomVoss:main Jun 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants