1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 00:45:38 +00:00

tooling: add --no-opt CLI flag and criterion compile benchmarks

Adds two items from the "Code quality / tooling" section of
docs/future-work.md. Both make it easier to chase regressions
without touching codegen.

- `nescript build --no-opt` skips the IR optimizer pass so
  optimizer-introduced miscompiles can be bisected against the
  unoptimized output. Threaded through CompileOptions and gated
  at the single optimizer call site in src/main.rs. Covered by a
  new integration test that compiles the same program twice
  (opt on / opt off) and asserts both outputs are valid iNES
  ROMs with matching headers and reset vectors.

- A criterion-based `benches/compile.rs` harness that times the
  full parse -> analyze -> lower -> optimize -> codegen -> link
  pipeline on every examples/*.ne file. Sources are pre-read
  into memory so file I/O stays off the hot loop, and each
  example gets its own Criterion group for easy regression
  spotting.

Committed ROM bytes under examples/*.nes are unchanged; the
emulator goldens under tests/emulator/goldens/ are untouched.
This commit is contained in:
Claude 2026-04-14 01:43:51 +00:00
parent d2cfce595b
commit 65a63f9a68
No known key found for this signature in database
5 changed files with 740 additions and 2 deletions

View file

@ -23,6 +23,11 @@ image = { version = "0.25", default-features = false, features = ["png"] }
[dev-dependencies]
pretty_assertions = "1"
criterion = "0.5"
[[bench]]
name = "compile"
harness = false
[profile.release]
lto = true