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.
incr_update_backup
Tyler Goodlet 2022-04-23 17:22:28 -04:00
parent 2c3da825e3
commit 5ca0d1a19d
1 changed files with 44 additions and 40 deletions

View File

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