Skip to content

perf: optimize wasmer/cranelift in dev profile for faster tests#50

Merged
sdbondi merged 1 commit intomainfrom
test-perf
Mar 30, 2026
Merged

perf: optimize wasmer/cranelift in dev profile for faster tests#50
sdbondi merged 1 commit intomainfrom
test-perf

Conversation

@sdbondi
Copy link
Copy Markdown
Member

@sdbondi sdbondi commented Mar 30, 2026

Summary

  • Add [profile.dev.package.*] with opt-level = 2 for wasmer and cranelift crates across all 11 template Cargo.toml files
  • Wasmer and Cranelift are ~10x slower when compiled in debug mode, making template tests painfully slow
  • Optimizes only the JIT-heavy crates (wasmer, wasmer-compiler, wasmer-compiler-cranelift, cranelift-codegen, cranelift-frontend, cranelift-entity) without affecting the rest of the project

Test plan

  • Run cargo test on individual templates to verify tests pass and are noticeably faster
  • Verify templates render correctly with in_cargo_workspace == "false" (profile sections inside conditional blocks)
  • Verify standalone templates (stable_coin, guessing_game) work correctly

🤖 Generated with Claude Code

Wasmer and Cranelift are ~10x slower in debug mode, making template tests
painfully slow. Add opt-level = 2 for these specific crates in dev profile
across all 11 template Cargo.toml files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes the wasmer and cranelift crates in development and test builds across multiple Cargo.toml files to improve test performance. The reviewer suggested using glob patterns for package overrides to make the configuration more concise and maintainable.

Comment on lines +26 to +37
[profile.dev.package.wasmer]
opt-level = 2
[profile.dev.package.wasmer-compiler]
opt-level = 2
[profile.dev.package.wasmer-compiler-cranelift]
opt-level = 2
[profile.dev.package.cranelift-codegen]
opt-level = 2
[profile.dev.package.cranelift-frontend]
opt-level = 2
[profile.dev.package.cranelift-entity]
opt-level = 2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better maintainability and conciseness, you can use glob patterns to specify the optimization level for multiple packages at once. Cargo's profile overrides support globs for package names, which can reduce the number of entries here from six to two.

This suggestion can be applied to all Cargo.toml files modified in this pull request.

Suggested change
[profile.dev.package.wasmer]
opt-level = 2
[profile.dev.package.wasmer-compiler]
opt-level = 2
[profile.dev.package.wasmer-compiler-cranelift]
opt-level = 2
[profile.dev.package.cranelift-codegen]
opt-level = 2
[profile.dev.package.cranelift-frontend]
opt-level = 2
[profile.dev.package.cranelift-entity]
opt-level = 2
[profile.dev.package.'wasmer*']
opt-level = 2
[profile.dev.package.'cranelift-*']
opt-level = 2

@sdbondi sdbondi merged commit 21901cf into main Mar 30, 2026
2 checks passed
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