Skip to content

Event loop scheduling improvement #282

Open
@kateinoigakukun

Description

@kateinoigakukun

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions