TartanLlama opened PR #12357 from TartanLlama:sy/high-priority-queue to bytecodealliance:main:
Currently, the main async event loop processes either all of the high-priority work items, or all of the low-priority work items if there are no high-priority items. This means that, if there are multiple low-priority tasks and an early one adds a task to the high-priority queue, this new task has to wait for the remaining low-priority tasks to complete before it gets a chance to run.
This PR changes the event loop to run at most one low-priority task on every iteration. As such, if this task enqueues a high-priority task, that task will get a chance to run before any other low-priority tasks.
I also reduced the nesting of the
poll_untilloop and added better names to make the code more easily understandable.
TartanLlama requested alexcrichton for a review on PR #12357.
TartanLlama requested wasmtime-core-reviewers for a review on PR #12357.
TartanLlama edited PR #12357:
Currently, the main async event loop processes either all of the high-priority work items, or all of the low-priority work items if there are no high-priority items. This means that, if there are multiple low-priority tasks and an early one adds a task to the high-priority queue, this new task has to wait for the remaining low-priority tasks to complete before it gets a chance to run.
This PR changes the event loop to run at most one low-priority task on every iteration. As such, if this task enqueues a high-priority task, that task will get a chance to run before any other low-priority tasks.
I also reduced the nesting of the
poll_untilloop, factored out pulling the work items out ofConcurrentState, and added better names to make the code more easily understandable.
github-actions[bot] added the label wasmtime:api on PR #12357.
alexcrichton requested dicej for a review on PR #12357.
alexcrichton unassigned alexcrichton from PR #12357 [async] Give more priority to high-priority work items.
I'm working on the
async_poll_stacklesstest failure now. Should have a fix soonish.
#12360 will fix the CI failure
dicej submitted PR review:
LGTM, thanks!
TartanLlama updated PR #12357.
dicej added PR #12357 [async] Give more priority to high-priority work items to the merge queue.
dicej merged PR #12357.
dicej removed PR #12357 [async] Give more priority to high-priority work items from the merge queue.
Last updated: Jan 29 2026 at 13:25 UTC