Minimal footprint. Maximum performance.
Lyx supports Energy-Aware-Compiling to generate energy-efficient machine code, controlled via CLI or function-level pragmas.
# Compile with energy level 1 (battery-optimized, minimal power) ./lyxc program.lyx -o program --target-energy=1 # Compile with energy level 3 (balanced, default) ./lyxc program.lyx -o program --target-energy=3 # Compile with energy level 5 (maximum performance) ./lyxc program.lyx -o program --target-energy=5
// This function compiles with level 1 (battery-optimized) @energy(1) fn low_power_task(): int64 { var sum: int64 := 0; var i: int64 := 0; while i < 1000 { sum := sum + i; i := i + 1; } return sum; } // This function compiles with level 5 (maximum performance) @energy(5) fn compute_intensive(): int64 { var result: int64 := 0; // Heavy computation uses SIMD/FPU return result; } fn main(): int64 { var x: int64 := low_power_task(); var y: int64 := compute_intensive(); return x + y; }
Minimal binary size means minimal energy consumption. Lyx binaries are designed to be efficient from the ground up.
Starting from just 4KB, Lyx binaries require minimal disk space and memory.
Small memory footprint makes Lyx perfect for embedded and resource-constrained environments.
Smaller binaries mean less energy for storage, transmission, and execution.
| Language | Binary Size | Runtime | Memory Usage |
|---|---|---|---|
| Go | ~2 MB | ~10 MB | ~5 MB |
| Rust | ~800 KB | ~2 MB | ~1 MB |
| Python | N/A | ~50 MB | ~20 MB |
| Lyx | 4-42 KB | 0 KB | <1 MB |
The compiler outputs detailed energy statistics after compilation
=== Energy Statistics === Energy level: 3 CPU family: 1 Optimize for battery: TRUE Avoid SIMD: TRUE Avoid FPU: FALSE Cache locality: TRUE Register over memory: TRUE Total ALU operations: 42 Total FPU operations: 0 Total SIMD operations: 0 Total memory accesses: 17 Total branches: 8 Total syscalls: 3 Estimated energy units: 16955 Code size: 846 bytes L1 cache footprint: 846 bytes