Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Muda: Waste Elimination

Muda (無駄) means “waste” – any activity that consumes resources without producing value. The Toyota Production System identifies seven types of waste and systematically eliminates each one.

The Seven Wastes in Software

Toyota WasteSoftware EquivalentBatuta Mitigation
OverproductionBuilding features nobody usesTargeted transpilation of requested files only
WaitingIdle CPU during I/O or serial buildsParallel tool execution via Repartir
TransportUnnecessary data movementCost-based backend selection (5x PCIe rule)
OverprocessingRedundant analysis passesIncremental analysis with state caching
InventoryStale build artifactsDeterministic builds, no artifact hoarding
MotionContext switching between toolsSingle batuta transpile entry point
DefectsBugs that require reworkJidoka quality gates at every phase

Waste Elimination in Batuta

Caching and Incremental Compilation

Batuta tracks pipeline state in .batuta-state.json. When a phase completes successfully, it is not re-run unless inputs change.

# First run: all 5 phases execute
$ batuta transpile --input ./project
Phase 1: Analysis       [2.1s]
Phase 2: Transpilation   [8.4s]
Phase 3: Optimization    [3.2s]
Phase 4: Validation      [5.1s]
Phase 5: Deployment      [1.0s]

# Second run: only changed phases re-execute
$ batuta transpile --input ./project
Phase 1: Analysis       [cached]
Phase 2: Transpilation   [1.2s]  # Only modified files
Phase 3: Optimization    [cached]
Phase 4: Validation      [5.1s]  # Re-validates changed output
Phase 5: Deployment      [1.0s]

Cost Circuit Breakers

GPU dispatch is expensive. Batuta prevents waste by applying the Gregg 5x rule: GPU is only selected when the compute benefit exceeds five times the data transfer cost.

#![allow(unused)]
fn main() {
// Muda: avoid wasteful GPU transfers for small operations
let backend = if data_size > threshold && compute_ratio > 5.0 {
    Backend::Gpu
} else {
    Backend::Simd  // SIMD avoids PCIe transfer entirely
};
}

Eliminating Redundant Analysis

PMAT quality analysis uses hash-based invalidation. If source files have not changed, the cached TDG score is reused. Cold cache takes approximately 7 seconds; warm cache responds in under 100 milliseconds. Invalidation triggers are explicit: Cargo.toml changes, git HEAD moves, or TTL expiration.

Eliminating Unnecessary Transpilation

Batuta only transpiles files that match a known source language with an available transpiler. Files already in Rust or belonging to unsupported languages are skipped:

$ batuta transpile --input ./mixed_project
Skipping: src/lib.rs (already Rust)
Transpiling: scripts/preprocess.py (via Depyler)
Transpiling: vendor/parser.c (via Decy)

The goal is not zero time per phase, but zero time spent on work that does not change the output.

Benefits

  1. Faster iteration – cached phases complete in milliseconds
  2. Lower cost – circuit breakers prevent unnecessary GPU spend
  3. Focused effort – only changed files are reprocessed
  4. Predictable builds – deterministic state tracking eliminates surprise rebuilds

Navigate: Table of Contents