Date: 2025-10-29 Status: ⚠️ PERFORMANCE REGRESSION DETECTED
The addition of fuzzy map support (generic PathMapDictionary<V>) has introduced 3-13% performance regressions in query operations across multiple benchmarks. This is likely due to:
benchmarks.rs - Core OperationsResult: Compiled and ran successfully
Key findings:
query_iterator_benchmarks.rs - Query PerformanceResult: PERFORMANCE REGRESSION DETECTED
Critical regressions:
| Benchmark | Regression | Impact |
|-----------|-----------|--------|
| ordered_vs_unordered/ordered/1 | +10.6% | 51.4μs (was 46.4μs) |
| ordered_vs_unordered/ordered/2 | +6.96% | 242μs (was 226μs) |
| ordered_query_dict_size_scaling/1000 | +13.7% | 249μs (was 219μs) |
| ordered_query_dict_size_scaling/5000 | +10.3% | 478μs (was 434μs) |
| ordered_query_algorithms/standard | +7.14% | 147μs (was 137μs) |
| large_distance_queries/50 | +51.5% | 9.65μs (was 6.37μs) |
Pattern: Ordered queries and larger dictionaries show the worst degradation
backend_comparison.rs - Compilation FixedResult: Compilation successful (not benchmarked yet)
Adding the generic type parameter V: DictionaryValue = () broke type inference in 9 benchmark locations:
benches/benchmarks.rs - 3 instances (lines 60, 113, 226)benches/backend_comparison.rs - 6 instances (lines 75, 146, 225, 304, 382, 459)// Before (broken):
let dict = PathMapDictionary::from_terms(vec![...]);
// After (fixed):
let dict: PathMapDictionary<()> = PathMapDictionary::from_terms(vec![...]);
The generic parameter V forces Rust to generate separate code for each value type:
PathMapDictionary<()> (unit type - no values)PathMapDictionary<u32> (scope IDs)PathMapDictionary<Vec<String>> (metadata lists)Impact: Increased binary size, potential instruction cache misses
The PathMap<V> structure now includes value storage:
pub struct PathMap<V: DictionaryValue = ()> {
root: Arc<PathMapNode<V>>, // Changed from PathMapNode
term_count: Arc<AtomicUsize>,
}
Impact: Different alignment, padding, cache line utilization
All node operations now require V: DictionaryValue bounds:
impl<V: DictionaryValue> PathMapNode<V> {
// Trait dispatch may add indirection
}
Impact: Virtual dispatch overhead, reduced inlining opportunities
backend_comparison.rs to establish full baselineCRITICAL - Must address before proceeding to Phase 2
Profile PathMapDictionary<()> operations using perf/flamegraph
Optimize value access paths
#[inline(always)] for value-related methodsBenchmark monomorphization impact
Potential Optimizations:
MaybeUninit<V> for unit type to eliminate storage#[repr(C)] or #[repr(align(...))] for consistent layoutPathMapDictionary<()>Cannot proceed with fuzzy map benchmarking until baseline performance is acceptable.
Baseline files:
baseline_benchmarks.txt - Core operationsquery_iterator_baseline.txt - Query performance (with regressions)Source files modified:
benches/benchmarks.rs (type annotations)benches/backend_comparison.rs (type annotations)Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |