perf: use lexical symbol ids for rank ties

This commit is contained in:
boris
2026-09-05 06:14:49 +08:00
parent d7e11be01f
commit 52f9ee9d92
2 changed files with 11 additions and 18 deletions
+9
View File
@@ -5093,6 +5093,15 @@ mod tests {
)
.unwrap();
let lexical_symbols = ["000001.SZ", "000300.SH", "600000.SH"];
let lexical_symbol_ids = lexical_symbols.map(|symbol| data.symbol_id(symbol).unwrap());
assert!(
lexical_symbol_ids
.windows(2)
.all(|window| window[0] < window[1]),
"symbol ids are the stable lexical tie-break key"
);
for symbol in ["000001.SZ", "600000.SH"] {
let symbol_id = data.symbol_id(symbol).unwrap();
let day = data.daily_snapshot_view(date);
+2 -18
View File
@@ -10301,15 +10301,7 @@ impl PlatformExprStrategy {
.unwrap_or(std::cmp::Ordering::Equal)
};
if ordering == std::cmp::Ordering::Equal {
let lhs_symbol = &universe_factor_day
.factor(lhs.0)
.expect("ranked candidate references missing factor row")
.symbol;
let rhs_symbol = &universe_factor_day
.factor(rhs.0)
.expect("ranked candidate references missing factor row")
.symbol;
lhs_symbol.cmp(rhs_symbol)
lhs.0.cmp(&rhs.0)
} else {
ordering
}
@@ -11028,15 +11020,7 @@ impl PlatformExprStrategy {
.unwrap_or(std::cmp::Ordering::Equal)
};
if ordering == std::cmp::Ordering::Equal {
let lhs_symbol = &universe_factor_day
.factor(lhs.0)
.expect("quote-plan candidate references missing factor row")
.symbol;
let rhs_symbol = &universe_factor_day
.factor(rhs.0)
.expect("quote-plan candidate references missing factor row")
.symbol;
lhs_symbol.cmp(rhs_symbol)
lhs.0.cmp(&rhs.0)
} else {
ordering
}