Event loop scheduling improvement
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, swift, wasm
- Domain
- performance, web-dev
Research direction
Start with the executor loop in Sources/JavaScriptEventLoop/JobQueue.swift, especially the linked section, and trace how queued Swift jobs run before control returns to the browser event loop. Define and evaluate a scheduling approach that yields after a bounded amount of executor time, with completion shown by higher-priority pending work no longer being blocked by low-priority jobs and performance impact being measured.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Swift
- Stars
- 986
- Forks
- 76
- Avg merge
- 21h 11m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from swiftwasm/JavaScriptKit
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
swiftwasm/JavaScriptKit#793 ·
-
swiftwasm/JavaScriptKit#785 · 1 assignee ·
-
[SwiftBuild] Preserve duplicate archive members when SwiftBuild expands static archives for linking Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
swiftwasm/JavaScriptKit#781 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
swiftwasm/JavaScriptKit#773 ·
-
swiftwasm/JavaScriptKit#767 · 1 assignee ·
All issues in swiftwasm/JavaScriptKit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
manaflow-ai/cmux#13763 ·
-
type: feature request
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
googleapis/google-cloud-swift#1036 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
wultra/mtoken-sdk-ios#253 ·
-
area:dictation documentation P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
uttrflow/uttrflow-swift#1180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100