Skip to content

Flatten WeakTopologicalOrdering into a single entry vector - #9220

Open
tlively wants to merge 2 commits into
wto-fast-pathsfrom
wto-flat
Open

tlively wants to merge 2 commits into
wto-fast-pathsfrom
wto-flat

Conversation

@tlively

@tlively tlively commented Oct 6, 2026

Copy link
Copy Markdown
Member

Replace the recursive std::variant/Cycle representation of
WeakTopologicalOrdering with a single contiguous std::vector
where cycle ends store the header block and jump target index. This
avoids per-cycle vector allocations and recursive evaluation in
WTOWorklist::run.

Benchmark results across 16 WebAssembly modules (3 iterations,
interleaved):

  • --constraint-analysis:
    • Geomean: 1.606s -> 1.592s (-0.9%)
    • Total time: 64.05s -> 63.67s (-0.6%; faster on 11/16 modules)
  • --rse:
    • Geomean: 0.871s -> 0.852s (-2.2%)
    • Total time: 26.03s -> 25.39s (-2.5%; faster on 12/16 modules)

Replace the recursive std::variant/Cycle representation of
WeakTopologicalOrdering with a single contiguous std::vector<Entry>
where cycle ends store the header block and jump target index. This
avoids per-cycle vector allocations and recursive evaluation in
WTOWorklist::run.

Benchmark results across 16 WebAssembly modules (3 iterations,
interleaved):
- --constraint-analysis:
  - Geomean: 1.606s -> 1.592s (-0.9%)
  - Total time: 64.05s -> 63.67s (-0.6%; faster on 11/16 modules)
- --rse:
  - Geomean: 0.871s -> 0.852s (-2.2%)
  - Total time: 26.03s -> 25.39s (-2.5%; faster on 12/16 modules)
@tlively
tlively requested a review from kripken October 6, 2026 07:10
@tlively
tlively requested a review from a team as a code owner October 6, 2026 07:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant