#proc-macro #codegen #macro #struct #rust

howlast

A procedural macro to easily misure computation times

2 releases

Uses new Rust 2024

new 0.1.1 Apr 12, 2025
0.1.0 Apr 12, 2025

#502 in Procedural macros


Used in rustedbytes-mandelbrot

GPL-3.0 license

15KB

howlast

howlast is a Rust procedural macro designed for timing code execution. It provides an easy way to measure the duration of specific code blocks, helping developers optimize performance.

Installation

To use howlast, add it as a dependency in your Cargo.toml file:

[dependencies]
howlast = "0.1.1"

Then, include the macro in your Rust code:

use howlast::howlast;

Example Usage

Here's an example of how to use the howlast macro:

use howlast::howlast;

fn main() {
   howlast!(step_duration, result => 
        { 
            let x = 1 + 1;
            std::thread::sleep(std::time::Duration::from_secs(1));
            x 
        }
    );

    print!("Ellapsed time: {:?} with result {}.", step_duration, result);
}

This will output the execution time of the code block along with the result of the computation.

No runtime deps