funtime

Crates.iofuntime
lib.rsfuntime
version0.3.1
sourcesrc
created_at2019-11-19 20:13:04.252649
updated_at2019-11-21 15:07:11.483308
descriptionA proc-macro helper to time Rust functions
homepage
repository
max_upload_size
id182526
size8,035
Jacob Brown (kardeiz)

documentation

README

funtime

Docs Crates.io

A small proc-macro helper to time every statement in a given function (or item method).

Usage

#[funtime::timed]
fn foo(y: i32) -> i32 {
    let mut x = 1;
    let d = 1_000;
    x += d;
    x += y;
    x
}   

#[funtime::timed]
fn main() {
    foo(23);
}

Prints:

funtime start: `foo`
  took 1µs: `let mut x = 1 ;`
  took 5µs: `let d = 1_000 ;`
  took 2µs: `x += d ;`
  took 2µs: `x += y ;`
  took 3µs: `x`
funtime end: `foo` took 12µs
funtime start: `main`
  took 49µs: `foo (23) ;`
funtime end: `main` took 56µs

Current version: 0.3.0.

Supports rustc 1.31 and up.

Commit count: 0

cargo fmt