-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chart graphics with drawing speedups #109
Comments
Thanks to finding pyqtgraph/pyqtgraph#1418 most of the CPU usage and latency issues are actually completely solved now! The latency measures I've been sampling on lines and cursor draw cycles still does scale approximately as
So, an attempt at creating lines graphics segments (of say 500 bars per slice) would likely improve latency when the user is viewing smaller sets of data when watching real-time / shorter time frames. I've already toyed with this idea where we are drawing separate pictures for history vs. the current bar to avoid calling |
Oh, also we've removed the |
Good news. Got a massive massive latency fix with large(r) data sets by using The only outstanding is getting appends to the historical bars path to be fast; this is still ongoing. |
Pertains further to #109. Instead of redrawing the entire `QPainterPath` every time there's a historical bars update just use `.addPath()` to slap in latest history. It seems to work and is fast. This also seems like it will be a great strategy for filling in earlier data, woot!
Pertains further to #109. Instead of redrawing the entire `QPainterPath` every time there's a historical bars update just use `.addPath()` to slap in latest history. It seems to work and is fast. This also seems like it will be a great strategy for filling in earlier data, woot!
Pertains further to #109. Instead of redrawing the entire `QPainterPath` every time there's a historical bars update just use `.addPath()` to slap in latest history. It seems to work and is fast. This also seems like it will be a great strategy for filling in earlier data, woot!
Adding binance's "hft" ws feeds has resulted in a lot of context switching in our Qt charts, so much so it's chewin CPU and definitely worth it to throttle to the detected display rate as per discussion in issue #192. This is a first very very naive attempt at throttling L1 tick feeds on the `brokerd` end (producer side) using a constant and uniform delivery rate by way of a `trio` task + mem chan. The new func is `data._sampling.uniform_rate_send()`. Basically if a client request a feed and provides a throttle rate we just spawn a task and queue up ticks until approximately the next display rate's worth period of time has passed before forwarding. It's definitely nothing fancy but does provide fodder and a start point for an up and coming queueing eng to start digging into both #107 and #109 ;)
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
In effort to start getting some graphics speedups as detailed in #109, this adds a `FastAppendCurve`to every `BarItems` as a `._ds_line` which is only displayed (instead of the normal mult-line bars curve) when the "width" of a bar is indistinguishable on screen from a line -> so once the view coordinates map to > 2 pixels on the display device. `BarItems.maybe_paint_line()` takes care of this scaling detection logic and is called by the associated view's `.sigXRangeChanged` signal handler.
Obviously determining the x-range from indices was wrong and was the reason for the incorrect (downsampled) output size XD. Instead correctly determine the x range and start value from the *values of* the input x-array. Pretty sure this makes the implementation nearly production ready. Relates to #109
Linking some Qt core issues that have been introduced by |
Had a great chat with a collaborator discussing some options for squeezing performance out of
pyqtgraph
.A lot was confirming ideas I had previous but a few nuggets are going to be particularly fun to experiment with.
Also note, there is no real latency problem yet but this is anticipation of updating multiple assets per plot.
This will all be more relevant once the first draft of #10 lands 🏄♂️ (soooon).
As part of that landing will come a naive charting update system using some well known slowly-ness like
np.append()
/np.concatenate()
(which frankly aren't anywhere near being a bottleneck yet) but which we can of course improve upon.The tip(s) received for improving rendering latency and general datum compacting include:
numpy
array 4x the size, and usenumba
to do the subsetting (aka downsampling in graphics land)pyqtgraph
has some similar implementations for lines in the code base that could be potentially improved with this:clipToView
algo codedownSampleMethod == 'peak'
codeFor updating the data layer instead of using the extremely naive
np.append()
/concatenate()
(which is stupidly slow):scala
This last point gets into more ideas we've had surrounding making a fast FSP stream processing system as per #106, #102, #107. Ideally we move towards a small DSL for compiling
numba
chained routines that can be easily declared from UI components.The text was updated successfully, but these errors were encountered: