mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
fmt
This commit is contained in:
parent
780952f922
commit
29d451ccb3
@ -29,10 +29,10 @@ fn bench_push_front_100(b: &mut test::Bencher) {
|
|||||||
#[bench]
|
#[bench]
|
||||||
fn bench_pop_back_100(b: &mut test::Bencher) {
|
fn bench_pop_back_100(b: &mut test::Bencher) {
|
||||||
let size = 100;
|
let size = 100;
|
||||||
let mut deq = VecDeque::<i32>::with_capacity(size+1);
|
let mut deq = VecDeque::<i32>::with_capacity(size + 1);
|
||||||
// We'll mess with private state to pretend like `deq` is filled.
|
// We'll mess with private state to pretend like `deq` is filled.
|
||||||
// Make sure the buffer is initialized so that we don't read uninit memory.
|
// Make sure the buffer is initialized so that we don't read uninit memory.
|
||||||
unsafe { deq.ptr().write_bytes(0u8, size+1) };
|
unsafe { deq.ptr().write_bytes(0u8, size + 1) };
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
deq.head = size;
|
deq.head = size;
|
||||||
@ -72,17 +72,17 @@ fn bench_retain_half_10000(b: &mut test::Bencher) {
|
|||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut v = v.clone();
|
let mut v = v.clone();
|
||||||
v.retain(|x| *x > size/2)
|
v.retain(|x| *x > size / 2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_pop_front_100(b: &mut test::Bencher) {
|
fn bench_pop_front_100(b: &mut test::Bencher) {
|
||||||
let size = 100;
|
let size = 100;
|
||||||
let mut deq = VecDeque::<i32>::with_capacity(size+1);
|
let mut deq = VecDeque::<i32>::with_capacity(size + 1);
|
||||||
// We'll mess with private state to pretend like `deq` is filled.
|
// We'll mess with private state to pretend like `deq` is filled.
|
||||||
// Make sure the buffer is initialized so that we don't read uninit memory.
|
// Make sure the buffer is initialized so that we don't read uninit memory.
|
||||||
unsafe { deq.ptr().write_bytes(0u8, size+1) };
|
unsafe { deq.ptr().write_bytes(0u8, size + 1) };
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
deq.head = size;
|
deq.head = size;
|
||||||
|
Loading…
Reference in New Issue
Block a user