@@ -452,32 +452,51 @@ mod tests {
452452 #[ test]
453453 fn run_performance_test_dist_fixed_ordering ( ) {
454454 println ! ( "Running performance test for Bremen dist (fixed node ordering)" ) ;
455- let input_graph = InputGraph :: from_file ( "meta/test_maps/bremen_dist.gr" ) ;
456- let mut fast_graph = prepare ( & input_graph) ;
457- let order = get_node_ordering ( & fast_graph) ;
455+ run_performance_test_fixed_ordering (
456+ & InputGraph :: from_file ( "meta/test_maps/bremen_dist.gr" ) ,
457+ & Params :: default ( ) ,
458+ 845493338 ,
459+ 30265 ,
460+ ) ;
461+ }
462+
463+ fn run_performance_test (
464+ input_graph : & InputGraph ,
465+ params : & Params ,
466+ expected_checksum : usize ,
467+ expected_num_not_found : usize ,
468+ ) {
469+ let mut fast_graph = FastGraph :: new ( 1 ) ;
458470 prepare_algo (
459- & mut |input_graph| fast_graph = prepare_with_order ( input_graph, & order ) . unwrap ( ) ,
471+ & mut |input_graph| fast_graph = prepare_with_params ( input_graph, params ) ,
460472 & input_graph,
461473 ) ;
462474 print_fast_graph_stats ( & fast_graph) ;
463475 let mut path_calculator = PathCalculator :: new ( fast_graph. get_num_nodes ( ) ) ;
464476 do_run_performance_test (
465477 & mut |s, t| path_calculator. calc_path ( & fast_graph, s, t) ,
466478 input_graph. get_num_nodes ( ) ,
467- 845493338 ,
468- 30265 ,
479+ expected_checksum ,
480+ expected_num_not_found ,
469481 ) ;
470482 }
471483
472- fn run_performance_test (
484+ fn run_performance_test_fixed_ordering (
473485 input_graph : & InputGraph ,
474486 params : & Params ,
475487 expected_checksum : usize ,
476488 expected_num_not_found : usize ,
477489 ) {
478- let mut fast_graph = FastGraph :: new ( 1 ) ;
490+ let mut time = Stopwatch :: start_new ( ) ;
491+ let mut fast_graph = prepare_with_params ( input_graph, params) ;
492+ time. stop ( ) ;
493+ println ! (
494+ "preparation time (heuristic order). {} ms" ,
495+ time. elapsed_ms( )
496+ ) ;
497+ let order = get_node_ordering ( & fast_graph) ;
479498 prepare_algo (
480- & mut |input_graph| fast_graph = prepare_with_params ( input_graph, params ) ,
499+ & mut |input_graph| fast_graph = prepare_with_order ( input_graph, & order ) . unwrap ( ) ,
481500 & input_graph,
482501 ) ;
483502 print_fast_graph_stats ( & fast_graph) ;
0 commit comments