1use chrono_probe::{
6 input::{distribution::Exponential, InputBuilder},
7 measurements::measure_mut,
8 plot::time_plot,
9};
10use chrono_probe::plot::PlotConfig;
11
12use crate::algorithms::{merge_sort_input, quick_sort_input};
13
14mod algorithms;
15mod input;
16
17fn main() {
18 let length_distribution = Exponential::new(1000..=500_000);
21
22 let vector_builder = InputBuilder::new(length_distribution, ());
24
25 let mut vectors = vector_builder.build_with_repetitions(200, 10);
28
29 let algorithms: &[(fn(&mut input::InputVec), &str); 2] = &[
31 (merge_sort_input, "Merge sort"),
32 (quick_sort_input, "Quick sort"),
33 ];
34
35 let results = measure_mut(&mut vectors, algorithms, 0.001);
37
38 let result_clone = results.clone();
39 result_clone.serialize_json("results.json");
41
42 let file_name = "results/sorting.svg";
43
44 let config = PlotConfig::default()
46 .with_title("Sorting algorithms")
47 .with_caption("The time plot of sorting algorithms");
48
49 time_plot(file_name, results, &config);
50}