swiftwasm / swiftwasm/JavaScriptKit

Event loop scheduling improvement

オープン
#282 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Swift
スター
986
フォーク
76
平均マージ
21時間 11分
マージ済み PR(30日)
4

説明

Motivation

Think the following situation:

  1. The browser event loop has a pending event that fires an event listener that schedules high-priority work to JSKit's executor.
  2. 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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Sources/JavaScriptEventLoop/JobQueue.swift の executor ループ、特にリンクされたセクションから始め、キューに入れられた Swift ジョブが実行されてから制御がブラウザのイベントループに戻るまでの流れを追跡します。一定量の executor 時間が経過したら実行を譲るスケジューリングアプローチを定義して評価し、より高い優先度の保留中の処理が低い優先度のジョブによってブロックされなくなったことを完了の指標として示し、パフォーマンスへの影響を測定します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, swift, wasm
領域
performance, web-dev
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。