Skip to content

Conversation

adrian-kong
Copy link
Contributor

@adrian-kong adrian-kong commented Mar 17, 2023

replaces timers to update whenever received new data

  1. means no more batched updates based on timer (may affect performance without strictly enforcing refresh rate)
  2. means more realtime update

@adrian-kong adrian-kong changed the title remove setting table timer remove setting table timer [CPP-872] Mar 17, 2023
@adrian-kong adrian-kong changed the title remove setting table timer [CPP-872] replace timers with functions [CPP-872] Mar 19, 2023
@adrian-kong adrian-kong requested a review from a team March 20, 2023 02:20
running: true
repeat: true
onTriggered: {
if (!advancedImuTab.visible)
Copy link
Contributor Author

@adrian-kong adrian-kong Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove .visible checks since capnproto is paused in backend when not in view.

the capnproto pause however isnt fully pause i.e. will still update anything in advanced subtabs
might be cleaner just to move to entirely pausing on capnproto side.

@swiftnav-travis
Copy link

Frontend and Release Workflow Started here

Copy link
Contributor

@pcrumley pcrumley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think this is a great idea and we should take this update.

However I have two main concerns:

  1. There is no explicit rate-limiting of calling the update function. I guess it probably is fine because the rust backend is rate limited at some level, but I'm not sure if we want to explicitly do something here at the front end, otherwise there could be perf issues.

  2. I haven't carefully looked at all of the code you refactored, but the timer would be called regardless if the data are updated. It's possible that people could have snuck code in there that may have handled things like window/zoom resizing or something that only had to do with frontend changes. Did you carefully audit the timer codes to confirm this wasn't the case? or if there were such things, they should be attached to the slot where the signal for that change would be emitted.

@adrian-kong
Copy link
Contributor Author

adrian-kong commented Mar 20, 2023

  1. There is no explicit rate-limiting of calling the update function.

not too sure on this but im guessing they have their own FPS cap for repainting

It's possible that people could have snuck code in there that may have handled things like window/zoom resizing or something that only had to do with frontend changes.

oh yea good point. will look into this some more.
(did see some resizing variables updating but should be fine as long as its updates that require data change)

@pcrumley
Copy link
Contributor

@adrian-kong yeah for #2 i didn't check closely enough to see if there were particular problems that would show up, everything i saw looked ok, i just wanted to bring it up in case you hadn't checked.

As for the limit on repainting, i think you are correct. But there could still be other expensive stuff that slows it down and affect perf. Just something to think about as you are giving the code a once-over.

These were just concerns i had, i don't think they are necessarily blockers to taking this PR.

@adrian-kong adrian-kong requested a review from pcrumley March 21, 2023 23:38
property bool labelsVisible: labelsVisibleCheckBox.checked
property bool polarChartWidthChanging: false

function clearLabels() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcrumley yeah it actually introduced a bug (no longer getting as frequent repainting of labels) so the timer sleep was making the labels flash.

this should be fixed now, also less refreshing now

@adrian-kong adrian-kong requested a review from a team March 21, 2023 23:40
@swiftnav-travis
Copy link

Frontend and Release Workflow Started here

Copy link
Contributor

@silverjam silverjam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this affect things like the refresh rate switch? How well does this run on the surface tablet that you have for testing?

parser.add_argument("--refresh-rate", type=int)

@silverjam
Copy link
Contributor

Showing a pretty big jump in CPU usage on my laptop.

Old
Screenshot 2023-03-21 192827

New
Screenshot 2023-03-21 193536

@adrian-kong
Copy link
Contributor Author

adrian-kong commented Mar 22, 2023

Showing a pretty big jump in CPU usage on my laptop.

Old Screenshot 2023-03-21 192827

New Screenshot 2023-03-21 193536

are you in the Maps tab or have clicked into it to initialize in both instance? seems like QtWeebEngineProcess is taking up most the CPU

(also good thing about pyside is apparently is if you dont click into the map, the js wont load so thats nice but qtwebengineprocess would run in background by default since webview component declared explicitly in the qml)

How will this affect things like the refresh rate switch?

played around refresh rate switch doesnt do much after these changes but this does enforce repainting on data tho which is pretty nice, would think theres a way to cap FPS on pyside instead maybe?

How well does this run on the surface tablet that you have for testing?

haven't tested on windows but for mac, the settings tab is much better where previously i was unable to scroll on

@silverjam
Copy link
Contributor

How will this affect things like the refresh rate switch?

played around refresh rate switch doesnt do much after these changes but this does enforce repainting on data tho which is pretty nice, would think theres a way to cap FPS on pyside instead maybe?

Yes, because the refresh rate switch is made useless by this PR -- we should remove it or rethink how it works.

The way this worked in the previous console was to just record the last update time and skip an update if it was "too soon" -- so, effectively let the data stream drive updates, but painting would be skipped if it was exceeding the configured refresh rate.

Example: https://github.com/swift-nav/piksi_tools/blob/5b723eb0bf9af28f26b6190c9e3dfa5551da7123/piksi_tools/console/solution_view.py#L439

How well does this run on the surface tablet that you have for testing?

haven't tested on windows but for mac, the settings tab is much better where previously i was unable to scroll on

Maybe we should think about making a more targeted update(s) first then, like just removing the timer from the settings view?

@silverjam
Copy link
Contributor

More informal benchmarks --

Latest main branch: + have not clicked into the map tab + tracking view full ==>

image

This branch: + have not clicked into the map tab + tracking view full ==>

image


After running for a while the main branch does start to look more like this branch, so not sure there's a clear perf story here, but definitely seems like the web process is doing a lot more than it should be (especially if it's not loaded):

image

@swiftnav-travis
Copy link

Frontend and Release Workflow Started here

@adrian-kong adrian-kong marked this pull request as draft March 23, 2023 06:05
@adrian-kong
Copy link
Contributor Author

adrian-kong commented Mar 26, 2023

removes refresh rate, since this makes the option redundant.
also see ticket, which seems to have little impact to performance (?)
https://swift-nav.atlassian.net/browse/CPP-806

@adrian-kong adrian-kong marked this pull request as ready for review March 26, 2023 22:21
@adrian-kong adrian-kong marked this pull request as draft March 26, 2023 22:21
@swiftnav-travis
Copy link

Frontend and Release Workflow Started here

@adrian-kong adrian-kong marked this pull request as ready for review March 27, 2023 07:48
@adrian-kong
Copy link
Contributor Author

adrian-kong commented Mar 27, 2023

@silverjam this seems to have roughly identical ~30% cpu (+- 1%) performance for cpu utilization after #989
compared to main branch

@silverjam
Copy link
Contributor

@pcrumley Please approved if your concerns have been addressed.

@swiftnav-travis
Copy link

Frontend and Release Workflow Started here

@adrian-kong adrian-kong merged commit e61ac89 into main Mar 27, 2023
@adrian-kong adrian-kong deleted the adrian/remove_timers branch March 27, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants