diff --git a/crates/fidc-core/src/data.rs b/crates/fidc-core/src/data.rs index 153e97a..27d33f0 100644 --- a/crates/fidc-core/src/data.rs +++ b/crates/fidc-core/src/data.rs @@ -566,7 +566,9 @@ struct SymbolPriceSeries { valid_volume_start_by_count: Vec, } -type DenseRowPositionIndex = BTreeMap>; +// Row groups keep their chronological BTreeMap for range scans, while the +// hot symbol-id lookup uses a hash index to avoid a tree traversal per row. +type DenseRowPositionIndex = AHashMap>; const MISSING_ROW_POSITION: u32 = u32::MAX; const MAX_DENSE_ROW_INDEX_BYTES: usize = 256 * 1024 * 1024; @@ -4048,7 +4050,7 @@ fn build_dense_row_positions( return None; } - let mut positions_by_date = BTreeMap::new(); + let mut positions_by_date = AHashMap::new(); for (date, rows) in groups { let symbol_ids = symbol_ids_by_date.get(date)?; if rows.len() != symbol_ids.len() {