37 lines
773 B
Rust
37 lines
773 B
Rust
use std::time::Instant;
|
|
|
|
use clap::Parser;
|
|
use julid::Julid;
|
|
|
|
#[derive(Debug, Parser)]
|
|
struct Cli {
|
|
#[clap(
|
|
long,
|
|
short,
|
|
help = "Number of Julids to generate",
|
|
default_value_t = 2_000
|
|
)]
|
|
pub num: usize,
|
|
}
|
|
|
|
fn main() {
|
|
let cli = Cli::parse();
|
|
let num = cli.num;
|
|
let mut v = Vec::with_capacity(num);
|
|
let start = Instant::now();
|
|
for _ in 0..num {
|
|
v.push(Julid::new());
|
|
}
|
|
let end = Instant::now();
|
|
let dur = (end - start).as_micros();
|
|
|
|
for id in v.iter() {
|
|
eprintln!(
|
|
"{id}: created_at {}; counter: {}; sortable: {}",
|
|
id.created_at(),
|
|
id.counter(),
|
|
id.sortable()
|
|
);
|
|
}
|
|
println!("{num} Julids generated in {dur}us");
|
|
}
|