Optimizing Performance

Compilation Tips

Generally, you will want to compile with a release build, sometimes even for development.

This is as simple as:

cargo build --release # you may need to check your release profile

This can oftentimes be the difference between 40% and 3% CPU usage.

Custom Nodes

The following tips generally can be of help:

  • Avoid allocation or system calls in the node.
  • Avoid any locking primitives. Prefer the rtrb crate for SPSC message passing.
  • If possible, branch at the entry of the function as opposed to hot, per sample paths, branchless may also help
  • Consider polynomial approximations or LUT, if it meets your accuracy demands.
  • Try to use nightly simd or auto-vectorization for math-heavy paths. Sometimes this kicks in for free when using chunking utilities that match the LANE size on your arch.