Skip to content

Reduce compilation time for feature-heavy builds #9

Description

@Tristan-Stoltz-ERC

Summary

Full-feature builds (--all-features) take significant time due to 98 feature flags and 55 workspace members. This issue tracks investigation and optimization of compile times.

Current state

  • 98 feature flags (default = empty set)
  • 55 workspace members (main crate + symthaea-core + 53 sub-crates)
  • CI runs 18+ feature combination jobs in the matrix
  • Key heavy features: lancedb-backend, neural-bridge, ssm_language, full_consciousness

Investigation areas

  1. Feature unification — identify features that are almost always used together and merge them
  2. Conditional compilation boundaries — ensure #[cfg(feature = "X")] is at module level, not sprinkled through functions
  3. Parallel compilation bottlenecks — identify crates that serialize the build graph
  4. Dependency deduplication — check for multiple versions of the same crate pulled by different features
  5. Build script optimization — audit build.rs files across sub-crates
  6. Type complexity — deeply nested generics slow rustc; identify hot spots with -Z time-passes

How to measure

# Time a full build from clean
cargo clean && time cargo build --all-features

# Identify slow crates
cargo build --all-features --timings

# Check dependency tree
cargo tree --duplicates

Constraints

  • Do NOT use custom CARGO_TARGET_DIR — sccache handles caching
  • One session per workspace to avoid cargo lock contention

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededperformancePerformance improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions