Function pew::clobber [] [src]

pub fn clobber()

This method forces the compiler to not optimize writes to memory in a benchmark.

Examples

use pew::{self, State};
use std::vec::Vec;

fn bm_simple(state: &mut State<u64>) {
    let mut vec = Vec::new();
    vec.push(1);
    vec.push(2);
    pew::clobber();
}

TODO: Conditionally compile this only on nightly so the rest of the benchmark crate can be used in stable.