OrderBook - low-hanging perf fix (GetHashCode)

This commit is contained in:
Jake Norbut committed 2018-02-05 11:11:49 -06:00
1 parent 0d8a7d948b
commit d3229b9756
2 files changed
+8 -3

No files matched your search

@@ -50,6 +50,12 @@ namespace mbts.spark
return this._order.Equals(other._order);
}
public override int GetHashCode() {
return this._order.GetHashCode();
}
// the grid view uses this for sorting, it was just a bts.api.Security once upon a time, but that class no longer implements IComparable
// this SelectableViewModeBase is essentially a wrapper class, which implements ISelecatble and IComparable
public SecurityImmutable security { get; }
@@ -30,12 +30,11 @@ namespace mbts.spark
_order_records = new ObservableCollection<OrderRecordImmutable>();
var orders_sequence = _model.on_orders;
var securities_sequence = _bus.subscribe(SparkTags.SecuritiesTag);
var orders_with_found_securities_sequence = orders_sequence.CombineLatest(securities_sequence,
var orders_with_found_securities_sequence = _model.on_orders.CombineLatest(securities_sequence,
(order_list, security_dict) => {
List<OrderBookRowVM> all_updated = new List<OrderBookRowVM>();
List<OrderBookRowVM> all_updated = new List<OrderBookRowVM>(order_list.state.Count);
foreach (var i in order_list.state.Values) {
if (security_dict.TryGetValue(i.Def.SecurityKey, out SecurityMD sec_md)) {
all_updated.Add(new OrderBookRowVM(_bus, this, _model, i, sec_md.security));