2023-07-25 19:04:38 +00:00
|
|
|
use std::time::Instant;
|
|
|
|
|
2023-07-29 23:16:13 +00:00
|
|
|
use clap::Parser;
|
2023-07-26 00:51:49 +00:00
|
|
|
use julid::Julid;
|
2023-07-25 19:04:38 +00:00
|
|
|
|
2023-07-29 23:16:13 +00:00
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
struct Cli {
|
|
|
|
#[clap(
|
|
|
|
long,
|
|
|
|
short,
|
|
|
|
help = "Number of Julids to generate",
|
|
|
|
default_value_t = 2_000
|
|
|
|
)]
|
|
|
|
pub num: usize,
|
|
|
|
}
|
|
|
|
|
2023-07-25 19:04:38 +00:00
|
|
|
fn main() {
|
2023-07-29 23:16:13 +00:00
|
|
|
let cli = Cli::parse();
|
|
|
|
let num = cli.num;
|
|
|
|
let mut v = Vec::with_capacity(num);
|
2023-07-25 19:04:38 +00:00
|
|
|
let start = Instant::now();
|
2023-07-29 23:16:13 +00:00
|
|
|
for _ in 0..num {
|
2023-07-25 19:04:38 +00:00
|
|
|
v.push(Julid::new());
|
|
|
|
}
|
|
|
|
let end = Instant::now();
|
|
|
|
let dur = (end - start).as_micros();
|
|
|
|
|
|
|
|
for id in v.iter() {
|
2023-07-29 23:16:13 +00:00
|
|
|
eprintln!(
|
2023-07-27 21:00:26 +00:00
|
|
|
"{id}: created_at {}; counter: {}; sortable: {}",
|
|
|
|
id.created_at(),
|
2023-07-25 19:04:38 +00:00
|
|
|
id.counter(),
|
|
|
|
id.sortable()
|
|
|
|
);
|
|
|
|
}
|
2023-07-29 23:16:13 +00:00
|
|
|
println!("{num} Julids generated in {dur}us");
|
2023-07-25 19:04:38 +00:00
|
|
|
}
|