# Changelog

## v0.2.0 (2026-06-30)

Pluggable cost model. Measure in nanoseconds, clock cycles, or your own weights.

**Added:**
- `cost_model = "cycles"` attribute parameter — use clock cycle estimates instead of nanoseconds
- `CostProfile` enum: `Nanoseconds` (default), `Cycles`, `Custom(CostTable)`
- `CostTable` struct with per-operation cost weights (alloc, syscall, alu, call, branch, etc.)
- Cycles cost table: 200 cycles for malloc, 3k for syscall, 15k for println (Zen4/Alder Lake baseline)
- Latency bounds now accept `cycles` unit: `latency = "< 5000cycles"`
- Error messages include the active unit name (e.g. "15000cycles exceeds bound 100cycles")
- 4 new compile-time test cases (2 pass, 2 fail) for the cycles cost model

**Changed:**
- All analysis functions now use the active `CostTable` instead of hardcoded constants
- Version bump to 0.2.0

**Unchanged:**
- All v0.1 annotations work identically — `cost_model` defaults to `"ns"` if omitted
- 14 existing test cases remain unchanged and pass

**Testing:**
- 18 total compile-time tests (8 pass, 10 fail-to-compile)
- Zero warnings on `cargo build`

---

## v0.1.0 (2026-06-11)

Initial release. Compile-time performance guarantees for Rust.

**Constraints:**
- `latency = "< 1ms"`: worst-case estimated execution time
- `throughput = "> 1GB/s"`: minimum sustained throughput
- `allocs = 0` or `allocs = "< 5"`: heap allocation count
- `syscalls = 0`: system call count (I/O, network, print)
- `max_stack = "< 4KB"`: stack frame size estimate

**Analysis:**
- AST-level static analysis via syn
- 20+ recognized allocating patterns (Vec, Box, String, HashMap, clone, collect, etc.)
- Syscall detection (fs, File, TcpStream, println, etc.)
- Loop cost estimation from literal ranges
- Worst-case branch analysis (if/else, match)
- Conservative cost model (x86-64 estimates)

**Testing:**
- 10 compile-time test cases via trybuild
- 4 pass cases (pure math, branching, loops, combined constraints)
- 6 fail cases (allocation, syscall, latency, network, println, loop allocs)
- Every fail case produces a specific compile error with the violation details
