Static vs runtime intelligence
Static intelligence relies on code parsing and syntax trees. Runtime intelligence executes your application to gather dynamic insights. HezGene uses both, making it 10x more accurate than standard linters.
By understanding both how your code is written and how it behaves when running, HezGene discovers optimization opportunities that traditional tools completely miss.
Insight
What static intelligence can see
HezGene's static scanners build an Abstract Syntax Tree (AST) of your entire codebase to calculate metrics without executing the code.
- Reachability: Which functions are never imported or called by entry points.
- Structural complexity: Cyclomatic complexity and branching depth.
- Token metrics: Halstead volume, difficulty, and effort.
- Duplication: Structurally identical code blocks disguised by different variable names.
- Dependency gaps: Imports that aren't declared in requirements.txt or pyproject.toml.
What static intelligence cannot see
Because static analysis doesn't run the program, it has blind spots:
- Dynamic routing: Frameworks like FastAPI or Click that register handlers via decorators. (HezGene fixes this with framework-aware AST plugins).
- Performance bottlenecks: It doesn't know how often a loop runs, only that it exists.
- Memory leaks: Cannot detect objects lingering in memory during execution.
- Reflection/Eval: Code called dynamically at runtime via getattr() or importlib.
What runtime intelligence adds
HezGene's Fitness Arena actually executes your code inside a sandboxed gauntlet:
- Execution Speed: Measures exact milliseconds taken across hundreds of executions.
- Memory Profiling: Tracks precise byte allocations using tracemalloc.
- Edge Case Resiliency: Fuzz-tests functions with unexpected inputs (None, [], massive ints).
- Verification: Ensures mutated code produces 100% identical outputs to the original.
Where they meet: fallow health
Codebase Intelligence combines these layers to give you a single health score for your project:
hezgene audit --applyWhen you run the master audit, HezGene correlates static dead code with runtime usage graphs to safely delete unused functions, while optimizing the survivors.
Dead code is one outcome, not the whole story
Deleting unused functions is great for hygiene, but HezGene is built for evolution. It mutates and improves the code that you do use:
- Loop Unrolling: Replaces slow for-loops with C-optimized list comprehensions.
- Guard Clauses: Reduces deep nesting by returning early on edge cases.
- Built-in replacement: Swaps manual min/max/sum logic for native Python built-ins.
Mental model
| Question | Static or Runtime? |
|---|---|
| Is this function ever called? | Static (Graph BFS) |
| Is this loop slowing down requests? | Runtime |
| Did the mutation break the output? | Runtime (Arena) |
| Is this import missing from pyproject.toml? | Static (DependencyScanner) |
| Are these two classes structurally identical? | Static (AST Normalizer) |
Free vs paid layer
HezGene is open source and entirely free. All AST mutations, static intelligence, and local fitness arenas run natively on your machine without any paid subscriptions.