IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

compiler

Provides compiler hints to prevent optimization of benchmark code.

This module includes utilities that prevent the compiler from optimizing away code being benchmarked. The keep() and black_box() functions provide hints to the compiler from overly optimizing away code being benchmarked.

Functions

  • black_box: Prevents the compiler from optimizing away computations or values.
  • keep: Provides a hint to the compiler to not optimize the variable use away.