]>
git.proxmox.com Git - rustc.git/blob - src/libcollections/benches/linked_list.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use std
::collections
::LinkedList
;
15 fn bench_collect_into(b
: &mut Bencher
) {
18 let _
: LinkedList
<_
> = v
.iter().cloned().collect();
23 fn bench_push_front(b
: &mut Bencher
) {
24 let mut m
: LinkedList
<_
> = LinkedList
::new();
31 fn bench_push_back(b
: &mut Bencher
) {
32 let mut m
: LinkedList
<_
> = LinkedList
::new();
39 fn bench_push_back_pop_back(b
: &mut Bencher
) {
40 let mut m
: LinkedList
<_
> = LinkedList
::new();
48 fn bench_push_front_pop_front(b
: &mut Bencher
) {
49 let mut m
: LinkedList
<_
> = LinkedList
::new();
57 fn bench_iter(b
: &mut Bencher
) {
59 let m
: LinkedList
<_
> = v
.iter().cloned().collect();
61 assert
!(m
.iter().count() == 128);
65 fn bench_iter_mut(b
: &mut Bencher
) {
67 let mut m
: LinkedList
<_
> = v
.iter().cloned().collect();
69 assert
!(m
.iter_mut().count() == 128);
73 fn bench_iter_rev(b
: &mut Bencher
) {
75 let m
: LinkedList
<_
> = v
.iter().cloned().collect();
77 assert
!(m
.iter().rev().count() == 128);
81 fn bench_iter_mut_rev(b
: &mut Bencher
) {
83 let mut m
: LinkedList
<_
> = v
.iter().cloned().collect();
85 assert
!(m
.iter_mut().rev().count() == 128);