-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPU Usage #6115
Conversation
…in-mode Request render optin mode
Globe imagery and terrain loading trigger renders in requestRenderMode
@ggetz, thanks for the pull request! Maintainers, we have a signed CLA from @ggetz, so you can review this at any time. I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
Double clicking on an Entity does not cause a render, I would expect this to happen because it is part of the Viewer widget (and camera interaction) |
Same bug (probably same root cause) happens when you click on the camera icon on the InfoBox. |
Hmm, that's weird. I would expect that to be caught with the camera change event since it's moving the camera and changing the transform |
Everything else looks fine to me! Who else wants to review this before it's merged? I'll plan on merging this first thing Monday morning unless someone wants more time to review (assuming all bugs are fixed). |
I would also expect the camera change to prompt a render, I'll take a look. |
I'm seeing a test failure
|
I think we should enable |
@hpinkos Thanks, fixed! Add requestRenderMode to the CeisumViewer, and both build and unbuilt are working as is. 👍 |
@hpinkos Good to merge? |
Taking a final look at this now, thanks for the reminder @ggetz! |
Great work on this @ggetz! |
Thanks @hpinkos for all the reviews! |
Right now, when I toggle the |
@thw0rted While at a high level, I agree with you, the problem of trying to handle all of these cases for end users is that it's tedious to maintain and hard to scale. I think one of the biggest scalability mistakes I made with the Entity API was trying to make everything automatically happen for the user. The end result is that browsers gobble up memory handling all of the subscriptions and notifications. So for request render mode, we made a conscious decision that the user would have to initiate the request. We may revisit this in the future (and god knows I would love to completely refactor the Entity API) but I don't expect that to happen in the near future. That being said, while writing this reply I had an idea. You can actually just listen to the Thanks. |
I had the same thought, having a sub to every entity's state would not scale very well, and I'm not sure how you even profile to figure out why it feels slow once it starts to bog down. I'll take a look at |
Changes from PRs #6065 and #6107
Opt in fix for #1865
Created opt-in
requestRenderMode
which will only render the scene when needed. Renders can be triggered as needed by callingrequestRender()
, for example if picking a feature should change it's color, or you make changes to the scene via the API.We render each time the simulation time change exceeds
scene.maximumRenderTimeChange
, which defaults to0.5
seconds. It can be set toundefined
orInfinity
to never change based on simulation time.Besides simulation time changes and calls to
requestRender
, always render when:FrameState.afterRender
function was called (this is used thorough the code base when changes are made after a render to keep the current state. An example would be when a new LOD of a tileset is shown or when a model is ready)In addition, I refactored some of the update/render logic in
Globe
,QuadtreePrimitive
, andGlobeSurfaceTileProvider
so that loading new tiles will continue to prompt render requests and finish processing the load queue. When the scene hasrequestRenderMode
enabled and there is a large or undefinedmaximumRenderTimeChange
, the globe will still load in completely, and changing terrain providers or imagery, and loading in higher level tiles when the camera changes will automatically trigger a render.