Search

PythonReactSEOPDF
GitHub Skill

cargo-llvm-lines

Analyzes LLVM IR to find monomorphization bloat and compile time hotspots. Use when debugging slow builds, reducing binary size, or optimizing generic code.

onbjerg☆ 4 Repository stars1 Repository forks

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

View source ↗Guides

Skill instructions

cargo-llvm-lines

Shows which functions generate the most LLVM IR lines, indicating compile time and binary size contributors.

Usage

cargo llvm-lines [OPTIONS]

Common Workflows

Analyze library crate
cargo llvm-lines --lib
Analyze specific binary
cargo llvm-lines --bin my_bin
Sort by copy count (monomorphization)
cargo llvm-lines --lib --sort copies
Filter to specific functions
cargo llvm-lines --lib | grep "my_module"

Key Options

  • --lib - Analyze library target
  • --bin <NAME> - Analyze specific binary
  • --release - Use release profile
  • --sort lines|copies - Sort by IR lines (default) or instantiation count

Reading Output

Output format: Lines | Copies | Function

  Lines  Copies  Function name
  -----  ------  -------------
  30000     100  core::fmt::write
   5000      50  alloc::vec::Vec<T>::push
  • Lines - Total LLVM IR lines from all instantiations
  • Copies - Number of monomorphized copies
  • High copies with moderate lines = monomorphization bloat

Common Fixes

  • Extract non-generic inner functions to reduce copies
  • Use dyn Trait instead of generics for cold paths
  • Consider #[inline(never)] on large generic functions

Examples

Read the usage examples in the source repository.

View source ↗

Source history

Indexed on
2026-01-20
Index updated
2026-03-03
Branch
main

Index and sync dates describe this directory. View the source repository for code history.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!