Patch glyphs rendering slowly when zoomed, compared to when fully visible in figure

Hi, I’m trying to use bokeh to display a exchange market depth plot (hence the variable names), which involves two patches of hundreds of points each plotted together on one plot.
The relevant code is shown below, and when viewed at the default zoom ranging, panning around produces noticeable lag. (note lod_threshold=None).
However, when scroll-zoomed out so that the entirety of both patches is visible, panning produces much less lag (an acceptable amount).

Is there a reason the different zoom levels produce differing amounts of lag?

I am already showing only a subset of the full data available.
I also don’t want to use lod_threshold, but also don’t see why it should help in this case.

import sys, math, json
from bokeh.plotting import figure
from bokeh.io import show
from bokeh.models import ColumnDataSource

fil = open(‘sampledata’, ‘r’)
b, s = json.loads(fil.read())
fil.close()

buys = ColumnDataSource(data=b)
sells = ColumnDataSource(data=s)

minx = buys.data[‘prices’][0] * 0.98 #default xrange of 2% on either side of the pricegap between buys and sells
maxx = sells.data[‘prices’][0] * 1.02
plot = figure(lod_threshold=None, x_range=(minx, maxx), y_range=(0, 400000), plot_width=1600)
plot.patch(‘prices’, ‘amounts’, source=buys, fill_color=’#00a000’, line_alpha=0)
plot.patch(‘prices’, ‘amounts’, source=sells, fill_color=’#a00000’, line_alpha=0)

show(plot)

``

The json file ‘sampledata’ is attached, along with the code as bokeh_speedtest.py
Python version is 3.6.1
Bokeh version is 0.12.13
Browser is Firefox (Quantum) 58.0.2 64bit on Windows 10

sampledata (88.1 KB)

bokeh_speedtest.py (608 Bytes)

To clarify, it seems the ‘Paint’ event is much slower when zoomed as opposed to when unzoomed (~150ms vs ~4ms)
These multiple paint events were produced by panning the plot around at the different zoom levels.

Hi,

I don't have any answer offhand, I would not expect zoom level to affect things in this way. It's could either be a general problem, or possibly a browser-specific issue.

So, this is worth investigating further when possible, but there's currently not a lot of bandwidth on the core team, so I'm not sure when that might be. In order to ensure that it does not get lost in the shuffle, I'd suggest making a GitHub issue with this information (including any data necessary to run) so that it can be tracked and prioritized at some point.

Thanks,

Bryan

···

On Feb 15, 2018, at 02:52, [email protected] wrote:

To clarify, it seems the 'Paint' event is much slower when zoomed as opposed to when unzoomed (~150ms vs ~4ms)
These multiple paint events were produced by panning the plot around at the different zoom levels.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8a0d9e8e-a230-448b-ac01-139b742bbdb8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.