@@ -19,10 +19,7 @@ fn bench_n_threads(n: usize) -> impl Fn(&mut Criterion) {
1919                n,  OBJ_NUM 
2020            ) , 
2121            |b| { 
22-                 b. iter_custom ( |t| { 
23-                     let  total = test_complecated_multiple_thread_gc ( t as  usize ,  n) ; 
24-                     total. 0  + total. 1 
25-                 } ) ; 
22+                 b. iter_custom ( |t| test_complecated_multiple_thread_gc ( t as  usize ,  n) ) ; 
2623            } , 
2724        ) ; 
2825    } 
@@ -34,40 +31,37 @@ fn immix_benchmark_single_thread(c: &mut Criterion) {
3431    c. bench_function ( 
3532        & format ! ( "singlethread gc benchmark--{} small objects" ,  OBJ_NUM ) , 
3633        |b| { 
37-             b. iter_custom ( |t| { 
38-                 let  total = test_complecated_single_thread_gc ( t as  usize ) ; 
39-                 total. 0  + total. 1 
40-             } ) ; 
34+             b. iter_custom ( |t| test_complecated_single_thread_gc ( t as  usize ) ) ; 
4135        } , 
4236    ) ; 
4337} 
4438
45- fn  immix_benchmark_single_thread_mark ( c :  & mut  Criterion )  { 
46-     gc_disable_auto_collect ( ) ; 
47-     set_evacuation ( false ) ; 
48-     c. bench_function ( 
49-         & format ! ( "singlethread gc mark benchmark--{} small objects" ,  OBJ_NUM ) , 
50-         |b| { 
51-             b. iter_custom ( |t| { 
52-                 let  total = test_complecated_single_thread_gc ( t as  usize ) ; 
53-                 total. 0 
54-             } ) ; 
55-         } , 
56-     ) ; 
57- } 
58- fn  immix_benchmark_single_thread_sweep ( c :  & mut  Criterion )  { 
59-     gc_disable_auto_collect ( ) ; 
60-     set_evacuation ( false ) ; 
61-     c. bench_function ( 
62-         & format ! ( "singlethread gc sweep benchmark--{} small objects" ,  OBJ_NUM ) , 
63-         |b| { 
64-             b. iter_custom ( |t| { 
65-                 let  total = test_complecated_single_thread_gc ( t as  usize ) ; 
66-                 total. 1 
67-             } ) ; 
68-         } , 
69-     ) ; 
70- } 
39+ //  fn immix_benchmark_single_thread_mark(c: &mut Criterion) {
40+ //      gc_disable_auto_collect();
41+ //      set_evacuation(false);
42+ //      c.bench_function(
43+ //          &format!("singlethread gc mark benchmark--{} small objects", OBJ_NUM),
44+ //          |b| {
45+ //              b.iter_custom(|t| {
46+ //                  let total = test_complecated_single_thread_gc(t as usize);
47+ //                  total.0
48+ //              });
49+ //          },
50+ //      );
51+ //  }
52+ //  fn immix_benchmark_single_thread_sweep(c: &mut Criterion) {
53+ //      gc_disable_auto_collect();
54+ //      set_evacuation(false);
55+ //      c.bench_function(
56+ //          &format!("singlethread gc sweep benchmark--{} small objects", OBJ_NUM),
57+ //          |b| {
58+ //              b.iter_custom(|t| {
59+ //                  let total = test_complecated_single_thread_gc(t as usize);
60+ //                  total.1
61+ //              });
62+ //          },
63+ //      );
64+ //  }
7165
7266fn  immix_benchmark_single_thread_alloc ( c :  & mut  Criterion )  { 
7367    gc_disable_auto_collect ( ) ; 
@@ -124,13 +118,12 @@ unsafe fn alloc_test_obj(gc: &mut Collector) -> *mut GCTestObj {
124118    a
125119} 
126120
127- fn  test_complecated_single_thread_gc ( num_iter :  usize )  -> ( Duration ,   Duration )  { 
121+ fn  test_complecated_single_thread_gc ( num_iter :  usize )  -> Duration  { 
128122    #[ cfg( feature = "shadow_stack" ) ]  
129123    return  { 
130124        SPACE . with ( |gc| unsafe  { 
131125            let  mut  gc = gc. borrow_mut ( ) ; 
132-             let  mut  total_mark = Duration :: new ( 0 ,  0 ) ; 
133-             let  mut  total_sweep = Duration :: new ( 0 ,  0 ) ; 
126+             let  mut  total = Duration :: new ( 0 ,  0 ) ; 
134127            for  _ in  0 ..num_iter { 
135128                let  mut  first_obj = alloc_test_obj ( & mut  gc) ; 
136129                let  rustptr = ( & mut  first_obj)  as  * mut  * mut  GCTestObj  as  * mut  u8 ; 
@@ -149,7 +142,9 @@ fn test_complecated_single_thread_gc(num_iter: usize) -> (Duration, Duration) {
149142                gc. add_root ( rustptr,  ObjectType :: Pointer ) ; 
150143                let  size1 = gc. get_size ( ) ; 
151144                assert_eq ! ( size1,  OBJ_NUM  + 1 ) ; 
152-                 let  ctime = gc. collect ( ) ; 
145+                 let  now = std:: time:: Instant :: now ( ) ; 
146+                 gc. collect ( ) ; 
147+                 total += now. elapsed ( ) ; 
153148                // println!("gc{} gc time = {:?}", gc.get_id(), ctime); 
154149                let  size2 = gc. get_size ( ) ; 
155150                assert_eq ! ( live_obj,  size2) ; 
@@ -158,10 +153,8 @@ fn test_complecated_single_thread_gc(num_iter: usize) -> (Duration, Duration) {
158153                gc. collect ( ) ; 
159154                let  size3 = gc. get_size ( ) ; 
160155                assert_eq ! ( size3,  0 ) ; 
161-                 total_mark += ctime. 0 ; 
162-                 total_sweep += ctime. 1 ; 
163156            } 
164-             ( total_mark ,  total_sweep ) 
157+             total 
165158        } ) 
166159    } ; 
167160    #[ cfg( not( feature = "shadow_stack" ) ) ]  
@@ -170,7 +163,7 @@ fn test_complecated_single_thread_gc(num_iter: usize) -> (Duration, Duration) {
170163    ( Duration :: new ( 0 ,  100 ) ,  Duration :: new ( 0 ,  100 ) ) 
171164} 
172165
173- fn  test_complecated_multiple_thread_gc ( num_iter :  usize ,  threads :  usize )  -> ( Duration ,   Duration )  { 
166+ fn  test_complecated_multiple_thread_gc ( num_iter :  usize ,  threads :  usize )  -> Duration  { 
174167    let  mut  handles = vec ! [ ] ; 
175168    for  _ in  0 ..threads { 
176169        let  t = std:: thread:: spawn ( move  || test_complecated_single_thread_gc ( num_iter) ) ; 
@@ -180,7 +173,7 @@ fn test_complecated_multiple_thread_gc(num_iter: usize, threads: usize) -> (Dura
180173    for  h in  handles { 
181174        times. push ( h. join ( ) . unwrap ( ) ) ; 
182175    } 
183-     times. sort_by ( |k1,  k2| ( k1. 0  + k1 . 1 ) . cmp ( & ( k2 . 0  + k2 . 1 ) ) ) ; 
176+     times. sort_by ( |k1,  k2| ( k1) . cmp ( k2 ) ) ; 
184177    times. pop ( ) . unwrap ( ) 
185178} 
186179
@@ -200,8 +193,8 @@ criterion_group!(
200193    benches, 
201194    immix_benchmark_multi_thread, 
202195    immix_benchmark_single_thread, 
203-     immix_benchmark_single_thread_mark, 
204-     immix_benchmark_single_thread_sweep, 
196+     //  immix_benchmark_single_thread_mark,
197+     //  immix_benchmark_single_thread_sweep,
205198    immix_benchmark_single_thread_alloc, 
206199) ; 
207200criterion_main ! ( benches) ; 
0 commit comments