Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 大量模组加载时卡顿严重 #42

Closed
1 task done
baka-gourd opened this issue Nov 25, 2021 · 4 comments
Closed
1 task done

[Bug] 大量模组加载时卡顿严重 #42

baka-gourd opened this issue Nov 25, 2021 · 4 comments
Assignees
Labels
bug Something isn't working performance
Projects

Comments

@baka-gourd
Copy link
Contributor

OS Version (系统版本)

Windows

Version Details (版本信息)

1.0.0-beta7

Describe the bug (问题描述)

在大量路径或者多个大包的情况下,启动会卡很长一段时间,推测是某些请求或io写成同步的了(比如检查更新)

To Reproduce (复现问题)

No response

Expected behavior (预期行为)

No response

This issue is unique (这个issue是唯一的)

  • I have searched the issue tracker and did not find an issue describing my bug.

Additional context (额外说明)

No response

@baka-gourd baka-gourd added the bug Something isn't working label Nov 25, 2021
@kaniol-lck
Copy link
Owner

每个路径加载其中的mod为独立于主线程的线程,应该不会出现阻塞主线程的问题。

比较可能的原因不是同步而是异步:启动时,多线程快速抢占系统资源,可以使CPU占用较高,观察一下资源监视器/任务管理器是否有出现CPU等瓶颈。之后会找方法适当进行惰性加载

检查更新也是完全异步进行的,虽然我将在 #41 中修改更新检查逻辑

某一路径中mod加载完毕后的列表绘制也可能造成卡顿,我会分散这部分的绘制卡顿

@kaniol-lck kaniol-lck self-assigned this Nov 25, 2021
@baka-gourd
Copy link
Contributor Author

每个路径加载其中的mod为独立于主线程的线程,应该不会出现阻塞主线程的问题。

比较可能的原因不是同步而是异步:启动时,多线程快速抢占系统资源,可以使CPU占用较高,观察一下资源监视器/任务管理器是否有出现CPU等瓶颈。之后会找方法适当进行惰性加载

检查更新也是完全异步进行的,虽然我将在 #41 中修改更新检查逻辑

某一路径中mod加载完毕后的列表绘制也可能造成卡顿,我会分散这部分的绘制卡顿

线程如果没有使用类似semaphore的来限制线程数量确实容易炸
不知道cpp有没有这种或者threadpool这种

@kaniol-lck kaniol-lck added this to To do in TODO List Nov 25, 2021
@kaniol-lck
Copy link
Owner

线程如果没有使用类似semaphore的来限制线程数量确实容易炸
不知道cpp有没有这种或者threadpool这种

当然有线程数量限制的,我使用的是高级的QtConcurrent控制多线程,其线程数量由线程池QThreadPool根据具体环境决定。

解决卡顿更需要的大概更应该是mod的Lazy loading,不在启动后立即载入所有路径并绘制列表,而在等待需要时再进行载入并绘制。

kaniol-lck added a commit that referenced this issue Nov 27, 2021
kaniol-lck added a commit that referenced this issue Nov 28, 2021
@kaniol-lck kaniol-lck moved this from To do to In progress in TODO List Nov 28, 2021
@kaniol-lck
Copy link
Owner

现在启动时是不会卡的,如果没什么别的问题咱就把issue关了(

@kaniol-lck kaniol-lck moved this from In progress to Done in TODO List Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance
Projects
Development

No branches or pull requests

2 participants