mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 15:10:54 +00:00
stream/buffer: Reduces map lookups by using key struct (#1309)
* stream/buffer: Adds key map optimisation (cherry-pick) * stream/buffer: Add buffer to DataHandler intermediary. Add field InitialUpdate bool to toggle when first update is seen for initial sync. * whoops * buffer: Add difference benchmarks for reference * glorious: nits (reverting out of context changes) * RM unused error that will be used later * purge: benchmark --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultJobBuffer = 1000
|
||||
defaultJobBuffer = 5000
|
||||
// defaultTrafficPeriod defines a period of pause for the traffic monitor,
|
||||
// as there are periods with large incoming traffic alerts which requires a
|
||||
// timer reset, this limits work on this routine to a more effective rate
|
||||
@@ -62,7 +62,7 @@ func SetupGlobalReporter(r Reporter) {
|
||||
func New() *Websocket {
|
||||
return &Websocket{
|
||||
Init: true,
|
||||
DataHandler: make(chan interface{}),
|
||||
DataHandler: make(chan interface{}, defaultJobBuffer),
|
||||
ToRoutine: make(chan interface{}, defaultJobBuffer),
|
||||
TrafficAlert: make(chan struct{}),
|
||||
ReadMessageErrors: make(chan error),
|
||||
|
||||
Reference in New Issue
Block a user