Skip to content

GC Perf 2#39

Merged
YangSpring429 merged 15 commits intoLunova-Studio:4.0.xfrom
IksRain:GC-perf-2
Feb 21, 2026
Merged

GC Perf 2#39
YangSpring429 merged 15 commits intoLunova-Studio:4.0.xfrom
IksRain:GC-perf-2

Conversation

@IksRain
Copy link
Contributor

@IksRain IksRain commented Feb 16, 2026

我通过测量发现了几处GC占用高的地方并尝试优化
为了测试API正确性,我引入了就地XUnit进行高内聚的测试
这些可能只是我测试用的,正式合并时可能会删除,但是如果觉得这很方便得话可以留着)

@IksRain
Copy link
Contributor Author

IksRain commented Feb 17, 2026

通过测量发现下载+启动原版的过程中MinecraftLaunch.Base.Models.Game.MinecraftEntry#GetRequiredAssetsGetRequiredLibraries产生的分配最多,并确定为序列化相关占用

@IksRain
Copy link
Contributor Author

IksRain commented Feb 17, 2026

我预计使用SHA1字节而不是string表示sha1优化性能

@IksRain
Copy link
Contributor Author

IksRain commented Feb 17, 2026

减少GetRequiredLibraries属于逻辑没多少变动纯结构的改变 有些顺手的无关逻辑的commits可以忽略,Review主要集中在 c184ed3 5aaa14e

测试主要集中在5aaa14e 即可

@IksRain
Copy link
Contributor Author

IksRain commented Feb 17, 2026

这是下载+启动时的GC检测图,可以看到有3.5个对象分配峰值
image
Json序列化相关的暂时先不看,那么只看2,4两个我们关注的峰值
第一次主要分配为XxxInstall中的CompleteXxxxxDependenciesAsync
第二次主要分配为RunInstallProcessorAsync
同时也能看到比起之前峰值占用低了15mb左右

我可能会开一个新的PR在并行/占用上对这些进行重构/优化

@IksRain IksRain marked this pull request as ready for review February 17, 2026 13:23
@YangSpring429 YangSpring429 merged commit a73f69a into Lunova-Studio:4.0.x Feb 21, 2026
1 check failed
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.

2 participants