Skip to content

build: add a fast test profile to cut edit-test iteration from minutes to seconds #809

Description

@inureyes

Summary

[profile.release] in Cargo.toml is tuned for shipping binaries (fat lto = true, codegen-units = 1, opt-level = 3, strip = true). All local and agent test iteration currently runs through this profile because target/debug is usually cold (the MLX C++ tree rebuild makes the debug profile expensive to warm). Add a dedicated fast profile for test/dev iteration.

Motivation (measured)

Measured facts from the 2026-07-17 implementation chain:

  • The main crate is a single ~390k-line crate, so any source edit recompiles the whole crate on one core (codegen-units = 1 blocks parallel codegen), followed by a fat-LTO link across ~439 locked crates. Measured at 4 to 6 minutes per incremental rebuild.
  • A typical issue cycle (developer edit-test iterations plus review-stage fixes) pays 5 to 8 such rebuilds, i.e. 25 to 45 minutes of pure compile time per small issue.
  • All-targets test runs multiply the LTO link per test binary.

Implementation plan

  1. Add [profile.test-fast] to Cargo.toml:
    • inherits = "release"
    • lto = "thin" (or false if thin-LTO still dominates link time; measure both)
    • codegen-units = 16
    • strip = false
    • incremental = true
    • keep opt-level = 3 (MLX-heavy tests need optimized numerics for tolerable runtimes; drop to 2 only if measurements show parity)
  2. Add a Makefile target test-fast (and optionally check-fast) wrapping cargo test --profile test-fast --features cuda, with a narrow-filter example in the help text.
  3. Document in the contributor/build docs which profile to use for iteration vs shipping.
  4. Parity check: run a representative narrow test set (e.g. models::minimax_m3, server::chat_request, mlxcel-core sampling and cache::ring) under both profiles and confirm identical pass/fail results; record the measured rebuild-time comparison (cold and incremental) in the PR body.

Acceptance criteria

  • [profile.test-fast] exists in Cargo.toml and builds with --features cuda
  • Makefile test-fast target exists and runs tests under the new profile
  • Contributor/build docs updated to state which profile to use for iteration vs shipping
  • Parity spot-check recorded: representative narrow test set produces identical pass/fail results under both profiles
  • Measured incremental rebuild speedup reported in the PR (expect roughly 3 to 5x)

Note: repository CI currently runs no test job, so this is purely a local/agent iteration improvement with no CI changes required.

Activity

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

Metadata

Metadata

Assignees

Labels

area:coremlxcel-core: MLX FFI, primitives, KV cache, layerspriority:mediumMedium prioritystatus:doneCompletedtype:enhancementNew features, capabilities, or significant additions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions