diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..a030bca --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[profile.release-with-debug] +inherits = "release" +debug = true diff --git a/.gitignore b/.gitignore index 5eff8ab..e330ebf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ target/ rustc-ice* .idea + +flamegraph.svg diff --git a/Cargo.toml b/Cargo.toml index 9ca1c26..67175ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "omics-core", "omics-molecule", "omics-variation", + "profile", ] resolver = "2" @@ -21,6 +22,7 @@ rust-version = "1.80.0" anyhow = "1.0.89" criterion = "0.5.1" regex = "1.9.6" +string-interner = "0.18.0" thiserror = "2.0.4" [workspace.lints.rust] diff --git a/profile/Cargo.toml b/profile/Cargo.toml new file mode 100644 index 0000000..099981a --- /dev/null +++ b/profile/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "profile" +version = "0.1.0" +license.workspace = true +edition.workspace = true +authors.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +publish = false + +[dependencies] +omics-coordinate = { path = "../omics-coordinate" } + +clap = { version = "4", features = ["derive"] } + +[lints] +workspace = true diff --git a/profile/src/contig.rs b/profile/src/contig.rs new file mode 100644 index 0000000..a83807a --- /dev/null +++ b/profile/src/contig.rs @@ -0,0 +1,28 @@ +//! Profiling of contigs. + +pub mod alloc; + +use clap::Parser; +use clap::Subcommand; + +/// The different aspects of contigs that can be profiled. +#[derive(Subcommand)] +pub enum Command { + /// Allocations of contigs. + Alloc(alloc::Args), +} + +/// Profiling of contigs. +#[derive(Parser)] +pub struct Args { + /// The subcommand. + #[command(subcommand)] + command: Command, +} + +/// The main method. +pub fn main(args: Args) { + match args.command { + Command::Alloc(args) => alloc::main(args), + } +} diff --git a/profile/src/contig/alloc.rs b/profile/src/contig/alloc.rs new file mode 100644 index 0000000..e63a464 --- /dev/null +++ b/profile/src/contig/alloc.rs @@ -0,0 +1,21 @@ +//! Profiling of contig allocations. + +use std::hint::black_box; + +use clap::Parser; +use omics_coordinate::Contig; + +/// Profiling of contig allocations. +#[derive(Parser, Debug)] +pub struct Args { + /// The number of allocations to use. + #[arg(default_value_t = 100_000_000)] + n: usize, +} + +/// The main method. +pub fn main(args: Args) { + for _ in 0..args.n { + let _ = black_box(Contig::new("seq0")); + } +} diff --git a/profile/src/main.rs b/profile/src/main.rs new file mode 100644 index 0000000..5c8c3b1 --- /dev/null +++ b/profile/src/main.rs @@ -0,0 +1,30 @@ +//! A profiling tool for developing `omics`. + +use clap::Parser; +use clap::Subcommand; + +pub mod contig; + +/// The different entities that can be profiled. +#[derive(Subcommand)] +pub enum Command { + /// Contig profiling. + Contig(contig::Args), +} + +/// Profiling of `omics` entities. +#[derive(Parser)] +pub struct Args { + /// The subcommand. + #[command(subcommand)] + command: Command, +} + +/// The main method. +pub fn main() { + let args = Args::parse(); + + match args.command { + Command::Contig(args) => contig::main(args), + } +}