binance: pre-allocate PriceVolumeSlice memory

This commit is contained in:
c9s 2021-06-29 14:59:51 +08:00 committed by c9s
parent 2ec01e3d28
commit f64b0e7a9f
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -510,6 +510,8 @@ func parseDepthEvent(val *fastjson.Value) (*DepthEvent, error) {
Symbol: string(val.GetStringBytes("s")), Symbol: string(val.GetStringBytes("s")),
FirstUpdateID: val.GetInt64("U"), FirstUpdateID: val.GetInt64("U"),
FinalUpdateID: val.GetInt64("u"), FinalUpdateID: val.GetInt64("u"),
Bids: make(types.PriceVolumeSlice, 0, 50),
Asks: make(types.PriceVolumeSlice, 0, 50),
} }
for _, ev := range val.GetArray("b") { for _, ev := range val.GetArray("b") {