70 %

Toast is in Beta!Learn more →

Chris Biscardi

Printing the execution time of a Rust expression

I added execution time to Toast which can be accomplished using the stdlib and a debug formatter.

rust
fn main() {
let start = Instant::now();
// do stuff here
// in toast, we do async work here using async_std and block_on
eprintln!("Toast executed in {:?}", start.elapsed());
}

The output for a Toast build looks like:

text
$ toast incremental .
Running toast with overridden binary path: /Users/chris/github/toastdotdev/toast/target/release/toast
▪▪▪ [14s] 323 pages created
▪▪▪ [3s] 323/323 remote sources compiled
▪▪▪ [2s] html rendered
Toast executed in 21.192417461s