howlast 0.1.2

A procedural macro to easily misure computation times.
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 40.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • mad4j/howlast
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mad4j

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.2"

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 => {
        let x = 1 + 1;
        std::thread::sleep(std::time::Duration::from_secs(1));
        x
    });
    print!("{:?}", step_duration);

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

    howlast!(step_duration, result => 2+2);
    print!("{:?} {:?}", step_duration, result);
}

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