Files
WAFER/Justfile
T
ok2 94f6cb6941 Add switchable optimization config and benchmark framework
WaferConfig: unified config controlling all optimizations individually.
ForthVM::new_with_config(config) to create VMs with custom optimization settings.
All 8 switchable optimizations: peephole, constant_fold, strength_reduce, dce,
tail_call, inline (IR passes) + stack_to_local_promotion (codegen).

Benchmark framework (crates/core/tests/benchmark_report.rs):
- 7 Forth benchmarks: Fibonacci, Factorial, SumRecurse, NestedLoops, GCD, MemFill, Collatz
- Correctness verification across all configs (runs in CI)
- Full report with 128 optimization combinations (cargo test --ignored)
- Measures execution time, compilation time, WASM module bytes
- CONSOLIDATE impact comparison

Key findings from benchmark report:
- Inlining: -77% exec time on Fibonacci, -92% on Collatz
- Stack-to-local promotion: -5.5% WASM module size
- CONSOLIDATE: -72% exec time on Fibonacci (call_indirect -> direct call)
- All optimizations combined: best overall performance
2026-04-02 12:24:57 +02:00

60 lines
1.0 KiB
Makefile

default:
just --list
# Build everything
build:
cargo build --workspace
# Run all tests
test:
cargo test --workspace
# Run Forth 2012 compliance tests
compliance:
cargo test --test compliance -- --nocapture
# Run clippy lints
clippy:
cargo clippy --workspace -- -D warnings
# Check formatting (Rust + Markdown)
fmt:
cargo fmt --all --check
dprint check
# Format code (Rust + Markdown)
fmt-fix:
cargo fmt --all
dprint fmt
# Run the REPL
repl:
cargo run -p wafer
# Run a Forth file
run file:
cargo run -p wafer -- {{file}}
# Run benchmarks
bench:
cargo bench --workspace
# Run optimization benchmark report
bench-opts:
cargo test -p wafer-core --test benchmark_report -- --nocapture --ignored
# Check dependency licenses and advisories
deny:
cargo deny check
# Detect unused dependencies
machete:
cargo machete --skip-target-dir
# Full CI check (what CI runs)
ci: fmt clippy deny test
# Check compilation without running
check:
cargo check --workspace