]>
git.proxmox.com Git - rustc.git/blob - src/librustc/benches/lib.rs
7 // Static/dynamic method dispatch
14 fn method(&self) -> isize;
17 impl Trait
for Struct
{
18 fn method(&self) -> isize {
24 fn trait_vtable_method_call(b
: &mut Bencher
) {
25 let s
= Struct { field: 10 }
;
26 let t
= &s
as &dyn Trait
;
27 b
.iter(|| t
.method());
31 fn trait_static_method_call(b
: &mut Bencher
) {
32 let s
= Struct { field: 10 }
;
33 b
.iter(|| s
.method());
36 // Overhead of various match forms
39 fn option_some(b
: &mut Bencher
) {
48 fn vec_pattern(b
: &mut Bencher
) {
49 let x
= [1, 2, 3, 4, 5, 6];