mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			252 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			252 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use core::ops::*;
 | |
| use test::Bencher;
 | |
| 
 | |
| // Overhead of dtors
 | |
| 
 | |
| struct HasDtor {
 | |
|     _x: isize,
 | |
| }
 | |
| 
 | |
| impl Drop for HasDtor {
 | |
|     fn drop(&mut self) {}
 | |
| }
 | |
| 
 | |
| #[bench]
 | |
| fn alloc_obj_with_dtor(b: &mut Bencher) {
 | |
|     b.iter(|| {
 | |
|         HasDtor { _x: 10 };
 | |
|     })
 | |
| }
 | 
