swiftwasm / swiftwasm/JavaScriptKit
Event loop scheduling improvement
还没有人认领这个 Issue。
- 主要语言
- Swift
- 星标
- 986
- 派生
- 76
- 平均合并
- 21 小时 11 分钟
- 30 天内合并 PR
- 4
描述
Motivation
Think the following situation:
- The browser event loop has a pending event that fires an event listener that schedules high-priority work to JSKit's executor.
- But the current JSKit's executor loop does not yield its control to JS event loop until all enqueued works are done
- Even if some of them are low-priority
It resulted in the higher priority works planned to be enqueued to JSKit's executor are blocked by lower priority works that are already enqueued even though browser engine knows about the pending event.
Outcome
- Performance gain
Potential solution
Although yielding control to JS engine for every Swift job is not a realistic approach due to high overheads, but it's still considerable to yield control when certain time is spent for the current JSKit's executor loop.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Sources/JavaScriptEventLoop/JobQueue.swift 中的执行器循环开始,尤其关注链接的部分,并跟踪排队的 Swift 任务如何运行,以及控制权如何返回浏览器事件循环。定义并评估一种调度方法,使其在执行器运行达到有界时长后让出执行权;通过展示较高优先级的待处理工作不再被低优先级任务阻塞,并测量对性能的影响,来证明该方法已完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, swift, wasm
- 领域
- performance, web-dev
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100