Skip to content

Performance

This page is a practical guide to profiling and improving the performance of your Incan programs.

Repository benchmark suite details (and profiling the compiler) live in Benchmarks & profiling (repository).

What to expect

The current beta builds through Rust and produces a native binary. Runtime performance can be close to Rust for many workloads, but it depends on current backend output and library behavior.

Two implications:

  • Builds can be slower than a single-step native compiler because the current beta builds through Rust.
  • Performance is explainable: when in doubt, inspect the generated Rust and profile the produced binary.

Profile your program

Build a release binary (generated project)

incan build myprogram.incn

Profile on macOS (Instruments)

xcrun xctrace record --template "Time Profiler" \
  --launch ./target/incan/myprogram/target/release/myprogram

Profile on Linux (perf)

perf record ./target/incan/myprogram/target/release/myprogram
perf report

Optimization tips (practical)

  • Prefer the canonical build: incan build file.incn (builds the generated Rust project in release mode today).
  • Avoid unnecessary clones: the code generator tries to avoid extra copying, but explicit .clone() in source will be preserved.
  • Prefer iterator-style code: list comprehensions compile to iterator chains.
  • Inspect current backend output: use incan inspect rust file.incn when you need to debug the Rust generated by the current backend.