File tree Expand file tree Collapse file tree 5 files changed +63
-65
lines changed
librustc_codegen_ssa/back/rpath Expand file tree Collapse file tree 5 files changed +63
-65
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ macro_rules! from_str_bench {
3535 . iter( )
3636 . cycle( )
3737 . take( 5_000 )
38- . filter_map( |s| <( $t ) >:: from_str( s) . ok( ) )
38+ . filter_map( |s| <$t >:: from_str( s) . ok( ) )
3939 . max( )
4040 } )
4141 }
@@ -51,7 +51,7 @@ macro_rules! from_str_radix_bench {
5151 . iter( )
5252 . cycle( )
5353 . take( 5_000 )
54- . filter_map( |s| <( $t ) >:: from_str_radix( s, $radix) . ok( ) )
54+ . filter_map( |s| <$t >:: from_str_radix( s, $radix) . ok( ) )
5555 . max( )
5656 } )
5757 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #![ feature( slice_patterns) ]
12#![ feature( test) ]
23
34extern crate test;
45
5- mod dispatch;
6- mod pattern;
6+ use test:: Bencher ;
7+
8+ // Static/dynamic method dispatch
9+
10+ struct Struct {
11+ field : isize
12+ }
13+
14+ trait Trait {
15+ fn method ( & self ) -> isize ;
16+ }
17+
18+ impl Trait for Struct {
19+ fn method ( & self ) -> isize {
20+ self . field
21+ }
22+ }
23+
24+ #[ bench]
25+ fn trait_vtable_method_call ( b : & mut Bencher ) {
26+ let s = Struct { field : 10 } ;
27+ let t = & s as & dyn Trait ;
28+ b. iter ( || {
29+ t. method ( )
30+ } ) ;
31+ }
32+
33+ #[ bench]
34+ fn trait_static_method_call ( b : & mut Bencher ) {
35+ let s = Struct { field : 10 } ;
36+ b. iter ( || {
37+ s. method ( )
38+ } ) ;
39+ }
40+
41+ // Overhead of various match forms
42+
43+ #[ bench]
44+ fn option_some ( b : & mut Bencher ) {
45+ let x = Some ( 10 ) ;
46+ b. iter ( || {
47+ match x {
48+ Some ( y) => y,
49+ None => 11
50+ }
51+ } ) ;
52+ }
53+
54+ #[ bench]
55+ fn vec_pattern ( b : & mut Bencher ) {
56+ let x = [ 1 , 2 , 3 , 4 , 5 , 6 ] ;
57+ b. iter ( || {
58+ match x {
59+ [ 1 , 2 , 3 , ..] => 10 ,
60+ _ => 11 ,
61+ }
62+ } ) ;
63+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ fn test_minimize2() {
5252fn test_rpath_relative ( ) {
5353 if cfg ! ( target_os = "macos" ) {
5454 let config = & mut RPathConfig {
55- used_crates : Vec :: new ( ) ,
55+ used_crates : & [ ] ,
5656 has_rpath : true ,
5757 is_like_osx : true ,
5858 linker_is_gnu : false ,
@@ -64,7 +64,7 @@ fn test_rpath_relative() {
6464 assert_eq ! ( res, "@loader_path/../lib" ) ;
6565 } else {
6666 let config = & mut RPathConfig {
67- used_crates : Vec :: new ( ) ,
67+ used_crates : & [ ] ,
6868 out_filename : PathBuf :: from ( "bin/rustc" ) ,
6969 get_install_prefix_lib_path : & mut || panic ! ( ) ,
7070 has_rpath : true ,
You can’t perform that action at this time.
0 commit comments