Skip to content

Commit 2cfac80

Browse files
committed
Minor cleanup
1 parent 93f12ce commit 2cfac80

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ For this to work `another_input_graph` must have the same number of nodes as `in
117117
|California&Nevada|1.890.816|4.630.444|
118118
|USA|23.947.348|57.708.624|
119119

120-
|graph|metric|preparation time|average query time (micros)|
120+
|graph|metric|preparation time|average query time|
121121
|-|-|-|-|
122-
|NY city|distance|15 s|108|
123-
|CAL&NV|distance|70 s|243|
124-
|USA|distance|21 min|1452|
125-
|NY city|time|10 s|54|
126-
|CAL&NV|time|50 s|149|
127-
|USA|time|11 min|856|
122+
|NY city|distance|15 s|108 μs|
123+
|CAL&NV|distance|70 s|243 μs|
124+
|USA|distance|21 min|1452 μs|
125+
|NY city|time|10 s|54 μs|
126+
|CAL&NV|time|50 s|149 μs|
127+
|USA|time|11 min|856 μs|
128128

129129
The shortest path calculation time was averaged over 100k random routing queries. The benchmarks were run using Rust 1.50.0
130130

src/lib.rs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)