Always maybe render graphics

Since we have in-view style rendering working for all curve types
(finally) we can avoid the guard for low uppx levels and without losing
interaction speed. Further don't delay the profiler so that the nested
method calls correctly report upward - which wasn't working likely due
to some kinda GC collection related issue.
incremental_update_paths
Tyler Goodlet 2022-04-23 17:22:28 -04:00
parent 64c6287cd1
commit b97ec38baf
1 changed files with 44 additions and 40 deletions

View File

@ -20,7 +20,6 @@ Chart view box primitives
""" """
from __future__ import annotations from __future__ import annotations
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
# import itertools
import time import time
from typing import Optional, Callable from typing import Optional, Callable
@ -907,54 +906,59 @@ class ChartView(ViewBox):
def maybe_downsample_graphics(self): def maybe_downsample_graphics(self):
uppx = self.x_uppx() uppx = self.x_uppx()
if not ( # if not (
# we probably want to drop this once we are "drawing in # # we probably want to drop this once we are "drawing in
# view" for downsampled flows.. # # view" for downsampled flows..
uppx and uppx > 6 # uppx and uppx > 6
and self._ic is not None # and self._ic is not None
): # ):
profiler = pg.debug.Profiler( profiler = pg.debug.Profiler(
msg=f'ChartView.maybe_downsample_graphics() for {self.name}', msg=f'ChartView.maybe_downsample_graphics() for {self.name}',
disabled=not pg_profile_enabled(), disabled=not pg_profile_enabled(),
# delayed=True,
gt=3,
# gt=ms_slower_then,
)
# TODO: a faster single-loop-iterator way of doing this XD # XXX: important to avoid not seeing underlying
chart = self._chart # ``.update_graphics_from_flow()`` nested profiling likely
linked = self.linkedsplits # due to the way delaying works and garbage collection of
plots = linked.subplots | {chart.name: chart} # the profiler in the delegated method calls.
for chart_name, chart in plots.items(): delayed=False,
for name, flow in chart._flows.items(): # gt=3,
# gt=ms_slower_then,
)
if ( # TODO: a faster single-loop-iterator way of doing this XD
not flow.render chart = self._chart
linked = self.linkedsplits
plots = linked.subplots | {chart.name: chart}
for chart_name, chart in plots.items():
for name, flow in chart._flows.items():
# XXX: super important to be aware of this. if (
# or not flow.graphics.isVisible() not flow.render
):
continue
graphics = flow.graphics # XXX: super important to be aware of this.
# or not flow.graphics.isVisible()
):
continue
use_vr = False graphics = flow.graphics
if isinstance(graphics, BarItems):
use_vr = True
# pass in no array which will read and render from the last # use_vr = False
# passed array (normally provided by the display loop.) # if isinstance(graphics, BarItems):
chart.update_graphics_from_flow( # use_vr = True
name,
use_vr=use_vr,
# gets passed down into graphics obj # pass in no array which will read and render from the last
# profiler=profiler, # passed array (normally provided by the display loop.)
) chart.update_graphics_from_flow(
name,
use_vr=True,
profiler(f'range change updated {chart_name}:{name}') # gets passed down into graphics obj
# profiler=profiler,
)
profiler.finish() profiler(f'range change updated {chart_name}:{name}')
profiler.finish()
# else: # else:
# # don't bother updating since we're zoomed out bigly and # # don't bother updating since we're zoomed out bigly and
# # in a pan-interaction, in which case we shouldn't be # # in a pan-interaction, in which case we shouldn't be