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

improve idle message loop #2385

Merged
merged 1 commit into from
Jul 18, 2024
Merged

improve idle message loop #2385

merged 1 commit into from
Jul 18, 2024

Conversation

fuzhenn
Copy link
Member

@fuzhenn fuzhenn commented Jul 18, 2024

总体思路是放宽idle message的调用门槛,让worker message分散到更长的时间周期里返回给主线程,同时不会因为主线程忙而长时间堵塞worker消息的返回。

主要改进如下:

  • 改为按百分比设置worker向主线程返回的消息数量,解决繁忙时,worker中消息排队过久的问题
  • busyLoop(animFrameLoop)返回更少消息:目前固定为idleLoop中返回比例的一半
  • 实测发现workerPool.commit()对性能影响很小,broadcastIdleMessage改为每次loop都会执行。

总体思路是放宽idle message的调用门槛,让worker message分散到更长的时间周期里返回给主线程,同时不会因为主线程忙而长时间堵塞worker消息的返回。

主要改进如下:
* 改为按百分比设置worker向主线程返回的消息数量,解决繁忙时,worker中消息排队过久的问题
* busyLoop(animFrameLoop)返回更少消息:目前固定为idleLoop中返回比例的一半
* 实测发现workerPool.commit()对性能影响很小,broadcastIdleMessage改为每次loop都会执行。
@fuzhenn fuzhenn merged commit 19df737 into master Jul 18, 2024
1 check passed
@fuzhenn fuzhenn deleted the fix-idle-msg branch July 18, 2024 08:44
@fuzhenn
Copy link
Member Author

fuzhenn commented Jul 18, 2024

fix maptalks/issues#710

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.

1 participant