减少文本因子读取临时分配
This commit is contained in:
@@ -2449,6 +2449,13 @@ impl DataSet {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn factor_text_rows_on(&self, date: NaiveDate) -> &[FactorTextValue] {
|
||||
self.factor_text_by_date
|
||||
.get(&date)
|
||||
.map(Vec::as_slice)
|
||||
.unwrap_or(&[])
|
||||
}
|
||||
|
||||
pub fn market_snapshots_on(&self, date: NaiveDate) -> Vec<&DailyMarketSnapshot> {
|
||||
self.market_by_date
|
||||
.get(&date)
|
||||
|
||||
@@ -3687,8 +3687,8 @@ impl PlatformExprStrategy {
|
||||
},
|
||||
available_text_factor_names: if self.stock_text_factors_required {
|
||||
ctx.data
|
||||
.factor_text_snapshots_on(date)
|
||||
.into_iter()
|
||||
.factor_text_rows_on(date)
|
||||
.iter()
|
||||
.map(|row| row.field.clone())
|
||||
.collect()
|
||||
} else {
|
||||
@@ -4081,8 +4081,8 @@ impl PlatformExprStrategy {
|
||||
extra_factors,
|
||||
extra_text_factors: if self.stock_text_factors_required {
|
||||
ctx.data
|
||||
.factor_text_snapshots_on(date)
|
||||
.into_iter()
|
||||
.factor_text_rows_on(date)
|
||||
.iter()
|
||||
.filter(|row| row.symbol == symbol)
|
||||
.map(|row| (row.field.clone(), row.value.clone()))
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user