Consider optimizations for heavily-nested scenarios
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- wasm
- Domain
- compilers, performance
Research direction
Start with the Phase 3 proposal material and the heavily nested generator and green-thread workload described in this issue. Measure the O(N) switching behavior when generator nesting is large, then review the results with the proposal group. Done means the group has agreed on a predictable optimization or proposal adjustment and documented it before the feature is considered finished.
Written by the indexing model from the issue text.
Description
Once this proposal gets to Phase 3 and we can study the performance of realistic workloads, I think it's important for this group to measure a workload that, e.g., uses stack-switching for both generators with green-threading where there are stacks of the form:
| green-thread-handler | generator-handler 0 | ... | generator-handler N | suspend to green-thread-handler |
Because generator nesting depth is controlled by the user program, this N can be arbitrarily-large (e.g., generators can be called recursively) and a naive implementation will require an O(N) search when switching between green threads.
Assuming that the cost of this O(N) search isn't somehow amortized away, it seems like we should work out a predictable optimization that engines can perform so that, in practice, suspension to the green-thread-handler is O(1) (like a native engine would do). Although optimizing the O(N) case in general doesn't seem possible, identifying a subset of cases that cover the above scenario does seem imminently possible. However, I think it's important for us to have a proper shared discussion about what this predictable optimization is before declaring this feature finished so that (1) we can publish it in some form and continue to claim that wasm has predictable performance, (2) if there is some small tweak or addition to the proposal that would make the optimization significantly simpler or more effective, we still have the opportunity to make that tweak.
- Dominant language
- WebAssembly
- Stars
- 216
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
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 WebAssembly/stack-switching
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/stack-switching#156 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/stack-switching#145 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/stack-switching#144 · 4 comments ·
-
JSPI integration Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/stack-switching#131 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
WebAssembly/stack-switching#128 · 6 comments ·
All issues in WebAssembly/stack-switching
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
internal.h中,漏掉了1个定义。 Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·