Timeit (timeit v0.1.0)

Provides helper functions for measuring the execution time of code in IEx.

Summary

Functions

Measures the time to evaluation an expression and prints it to stdout. Returns the value of the expression. Supports optional label and/or unit arguments.

Functions

Link to this macro

timeit(unit \\ :microsecond, block)

(macro)

Measures the time to evaluation an expression and prints it to stdout. Returns the value of the expression. Supports optional label and/or unit arguments.

Examples

iex> timeit 1 + 2
5μs
3

iex> timeit "addition", 1 + 2
addition: 5μs
3

iex> timeit :nanosecond, 1 + 2
5000ns
3

iex> timeit "addition", :nanosecond, 1 + 2
addition: 5000ns
3
Link to this macro

timeit(label, unit, block)

(macro)