Skip to content

Reduce Amount of Allocations - #376

Open
florianhartung wants to merge 10 commits into
mainfrom
dev/reduce-amount-allocations
Open

Reduce Amount of Allocations#376
florianhartung wants to merge 10 commits into
mainfrom
dev/reduce-amount-allocations

Conversation

@florianhartung

@florianhartung florianhartung commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Open Questions / TODOs

Benchmark Results

Coremark Results:

On main I get 311 and 312. On this branch I get 344 and 348.

I expect that the optimized br_table execution is responsible for this. Maybe it's in a hot loop somewhere. The coremark benchmark definitly contains ~10 br.table instructions

References

Checks

  • Using Nix
    • Ran nix fmt
    • Ran nix flake check '.?submodules=1'
  • Using Rust tooling
    • Ran cargo fmt
    • Ran cargo test
    • Ran cargo check
    • Ran cargo build
    • Ran cargo clippy --workspace
    • Ran cargo doc --document-private-items --workspace

@florianhartung florianhartung changed the title Dev/reduce amount allocations Reduce Amount of Allocations Jul 23, 2026
@florianhartung
florianhartung force-pushed the dev/reduce-amount-allocations branch 3 times, most recently from c2afbfd to 0e279fb Compare July 27, 2026 11:06
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.61261% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.11%. Comparing base (423c20f) to head (a24225e).

@@            Coverage Diff             @@
##             main     #376      +/-   ##
==========================================
- Coverage   88.15%   88.11%   -0.05%     
==========================================
  Files          59       59              
  Lines       14769    14895     +126     
  Branches    14769    14895     +126     
==========================================
+ Hits        13020    13125     +105     
- Misses       1045     1061      +16     
- Partials      704      709       +5     
Components Coverage Δ
interpreter 88.11% <87.61%> (-0.05%) ⬇️
checked ∅ <ø> (∅)
linker ∅ <ø> (∅)
interop ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@florianhartung
florianhartung requested a review from cemonem July 27, 2026 11:23
@florianhartung
florianhartung force-pushed the dev/reduce-amount-allocations branch 3 times, most recently from 461e883 to faea17c Compare July 29, 2026 12:30
wasm.move_start_to(*span).unwrap_validated();

let mut stack = Stack::new::<T>(Vec::new(), &FuncType::new_empty(), &[])?;
// If there is a stack to use, clear and reinitialize it. Otherwise create a new stack.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a future pr, we can remove this stack all together and have a flag if we're supposed to have more than 1 item in the stack (that we pretend to have) since all constexpr instructions are already values by themselves

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK we discussed this topic already. For now, I'd like to keep the stack because it allows us to easily implement the Extended Const Expressions proposal (which is part of Wasm 3)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, the value stack may be untyped for constant expressions. #394 combined with #389 may therefore result in quite performant code

Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
…oding

Signed-off-by: Florian Hartung <florian.hartung@dlr.de>
@florianhartung
florianhartung force-pushed the dev/reduce-amount-allocations branch from faea17c to a24225e Compare July 31, 2026 12:57
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.

2 participants