diff --git a/Cargo.toml b/Cargo.toml index f70a5d0..fa1860a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "julid-rs" -version = "1.6.18" +version = "1.6.180" authors = ["Joe Ardent "] edition = "2021" keywords = ["ulid", "library", "sqlite", "extension", "julid"] @@ -18,7 +18,7 @@ sqlx = ["dep:sqlx"] # WARNING! don't enable this feature in your project's Cargo.toml if using julid-rs as a dependency; # see https://gitlab.com/nebkor/julid/-/issues/1 -plugin = ["sqlite-loadable"] # builds libjulid.* for loading into sqlite +plugin = ["dep:sqlite-loadable"] # builds libjulid.* for loading into sqlite [lib] name = "julid" @@ -32,5 +32,8 @@ serde = { version = "1.0", features = ["derive"], optional = true } sqlx = { version = "0.7", features = ["sqlite"], default-features = false, optional = true } sqlite-loadable = { version = "0.0.5", optional = true } +[dev-dependencies] +clap = { version = "4.3.19", default-features = false, features = ["help", "usage", "std", "derive"] } + [package.metadata.docs.rs] -all-features = true \ No newline at end of file +all-features = true diff --git a/VERSION b/VERSION index 2dab55d..d0873b8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.618 +1.6180 diff --git a/examples/benchmark.rs b/examples/benchmark.rs index cc44a03..1e8bfd2 100644 --- a/examples/benchmark.rs +++ b/examples/benchmark.rs @@ -1,23 +1,37 @@ 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 mut v = Vec::with_capacity(2000); + let cli = Cli::parse(); + let num = cli.num; + let mut v = Vec::with_capacity(num); let start = Instant::now(); - for _ in 0..2000 { + for _ in 0..num { v.push(Julid::new()); } let end = Instant::now(); let dur = (end - start).as_micros(); for id in v.iter() { - println!( + eprintln!( "{id}: created_at {}; counter: {}; sortable: {}", id.created_at(), id.counter(), id.sortable() ); } - println!("2000 IDs generated in {dur}us"); + println!("{num} Julids generated in {dur}us"); }