[package]
name = "masstree"
version = "0.7.4"
edition = "2024"
rust-version = "1.92.0"
authors = ["consistent-milk12"]
description = "A high-performance concurrent ordered map (trie of B+trees)"
license = "MIT"
repository = "https://github.com/consistent-milk12/masstree"
documentation = "https://docs.rs/masstree"
keywords = [
	"data-structures",
	"concurrent",
	"ordered-map",
	"range-scans",
	"trie",
]
categories = ["data-structures", "concurrency", "database-implementations"]
readme = "README.md"
include = ["src/**/*", "Cargo.toml", "LICENSE", "README.md"]

[features]
default = []
# Optimal Allocator for this data structure
mimalloc = ["dep:mimalloc"]
# When disabled (default), all tracing calls compile to no-ops with zero overhead.
# When enabled, auto-initializes a subscriber that writes NDJSON logs to logs/masstree.jsonl.
# Respects RUST_LOG env var (default: info). Set MASSTREE_LOG_CONSOLE=0 to disable console.
tracing = ["dep:tracing", "dep:tracing-subscriber", "dep:tracing-appender"]
true-inline = []                                                            # Enable true-inline value storage
debug-routing = []                                                          # Enable routing debug output for bug investigation
no-prefetch = []                                                            # Disable all software prefetching for A/B benchmarking
insert-stats = []                                                           # Enable insert retry statistics collection

# Use 512-byte inline suffix capacity instead of 256-byte default.
# Only enable for workloads without multi-layer key prefixes.
large-suffix-capacity = []

[dependencies]
seize = "0.5.1"
arrayvec = "0.7.6"
static_assertions = "1.1.0"
rustc-hash = "2.1.1"
crossbeam-queue = "0.3.12"

# Optional allocators (enabled via features)
mimalloc = { version = "0.1.48", optional = true }

# Optional tracing (enabled via features) - zero overhead when disabled
# "attributes" enables #[instrument] for function-level tracing
tracing = { version = "0.1.44", features = ["attributes"], optional = true }
tracing-subscriber = { version = "0.3.22", features = [
	"env-filter",
	"fmt",
	"json",
], optional = true }
tracing-appender = { version = "0.2.4", optional = true }

[dev-dependencies]
parking_lot = "0.12.5"
clap = { version = "4.5.54", features = ["derive"] }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
divan = "0.1.21"
proptest = "1.9.0"
loom = "0.7.2"
shuttle = "0.8.1"
papaya = "0.2.3"
dashmap = "6.1.0"
congee = "0.4.1"
crossbeam-skiplist = "0.1.3"
crossbeam-epoch = "0.9.18"
rand = "0.9.2"
# TODO: 0.10.0 available but conflicts with rand_core, check again later.
rand_chacha = "0.9.0"
rand_distr = "0.5.1"
indexset = { version = "0.14.0", features = ["concurrent"] }
scc = "3.5.5"
sdd = "4.6.2"
tracing = { version = "0.1.44", features = ["attributes"] }
tracing-subscriber = { version = "0.3.22", features = [
	"env-filter",
	"fmt",
	"json",
	"parking_lot",
] }
criterion = { version = "0.8.2", features = [
	"html_reports",
	"csv_output",
	"real_blackbox",
] }
iai-callgrind = "0.16.1"

# Examples dependencies
rayon = "1.11.0"
core_affinity = "0.8.3"
tokio = { version = "1.49.0", features = ["full"] }

[lints.rust]
# Allow loom and shuttle cfg for deterministic concurrency testing
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)', 'cfg(shuttle)'] }

[profile.dev]
opt-level = 0
debug = true
debug-assertions = true
overflow-checks = true
incremental = true

[profile.release]
opt-level = 3
debug = false
debug-assertions = false
overflow-checks = false
lto = "fat"
panic = "abort"
codegen-units = 1
strip = "symbols"

[profile.release-with-debug]
inherits = "release"
debug = 2
strip = "none"
lto = false

# Profiling profile - optimized for flamegraph/perf
# Frame pointers required for accurate stack traces
[profile.profiling]
inherits = "release"
debug = 2
strip = "none"
lto = false

# Force frame pointers in our code (dependencies need RUSTFLAGS)
[profile.profiling.package."*"]
debug = true

[profile.bench]
inherits = "release"

[[bench]]
name = "concurrent_maps15"
harness = false

[[bench]]
name = "concurrent_read_write"
harness = false

[[bench]]
name = "concurrent_read_write_scaled"
harness = false

[[bench]]
name = "concurrent_read_write_masstree"
harness = false

[[bench]]
name = "concurrent_read_write_masstree_scaled"
harness = false

[[bench]]
name = "concurrent_masstree15"
harness = false

[[bench]]
name = "range_masstree15"
harness = false

[[bench]]
name = "range_masstree15_inline"
harness = false

[[bench]]
name = "mttest"
harness = false

[[bench]]
name = "extreme_stress"
harness = false

[[bench]]
name = "high_impact"
harness = false

[[bench]]
name = "high_impact_masstree"
harness = false

[[bench]]
name = "rwlock_btreemap_vs_masstree15"
harness = false

[[bench]]
name = "rwlock_btreemap_vs_masstree15_inline"
harness = false

# =========================================================================
# Examples
# =========================================================================

[[example]]
name = "basic_usage"
path = "examples/basic_usage.rs"

[[example]]
name = "rayon_parallel"
path = "examples/rayon_parallel.rs"

[[example]]
name = "tokio_async"
path = "examples/tokio_async.rs"

[[example]]
name = "url_cache"
path = "examples/url_cache.rs"

[[example]]
name = "session_store"
path = "examples/session_store.rs"
