fix: remove redundant cache load and avoid GSettings lookup on every tick#534
fix: remove redundant cache load and avoid GSettings lookup on every tick#534glazari1 wants to merge 1 commit intocorecoding:graph-historyfrom
Conversation
…tick - Extract _ensureTimeSeriesLoaded() to deduplicate cache load + merge logic (used on first hover and on disable) - Remove redundant loadTimeSeries() from _init() — the lazy-load in _ensureTimeSeriesLoaded() handles it with proper merge - Cache show-sensor-history-graph in a _recordTimeSeries flag instead of calling get_boolean() on every sensor tick - Keep _recordTimeSeries and _timeSeriesLoaded in sync on setting toggle
|
I forgot to push a change before your last PR, now there is a minor conflict. My primary change is below - this gets rid of two for loops. By the way, I ended up submitting an update to Vitals with the History feature removed. Another person submitted a bug report. I would like to get more people verifying this PR fixes the issue. In all honesty, even with 200 instead of 3600 datapoints, I still feel like there will be a stutter, albeit smaller. |
|
Thanks for the update! I understand the decision to remove the feature in v74 while it's being validated. For what it's worth, I've been running the Let me know if you'd like me to help with anything else or if more testing data would be useful. |
Hey @corecoding, here's the follow-up with the two items from my comment.
Summary
_ensureTimeSeriesLoaded()to deduplicate the cache load + mergelogic (now used on first hover and on disable — prevents overwriting
persisted history when the user never opened the popout)
loadTimeSeries()from_init()— the lazy-loadhandles it with proper merge
show-sensor-history-graphin a_recordTimeSeriesflag insteadof calling
get_boolean()on every sensor tick (6 calls/sec withdefault settings)
_recordTimeSeriesand_timeSeriesLoadedin sync when togglingthe setting on/off
Changes
extension.js:
_ensureTimeSeriesLoaded()method (extracted from_showHistoryPopout)_showHistoryPopout()calls_ensureTimeSeriesLoaded()instead of inline mergedisable()calls_ensureTimeSeriesLoaded()before saving_recordTimeSeriesand_timeSeriesLoadedon toggleloadTimeSeries()from_init()values.js:
_recordTimeSeriesflag initialized from settings in_init()_pushTimePoint()checks cached flag instead ofget_boolean()Test plan
pidstat— no GSettings overhead on every tick