Skip to content
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

Improve performance of 3D scenes by sending multiple messages at once #3017

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

falkoschindler
Copy link
Contributor

This PR experiments with sending all non-update messages at once to reduce the time for creating complex 3D scenes like discussed in #3009.

A demo with 10,000 boxes still takes a while:

with ui.scene() as scene:
    scene.move_camera(y=-6, z=7)
    for x in range(100):
        for y in range(100):
            scene.box().scale(0.09).move(x / 10 - 5, y / 10 - 5)

I'm not sure if sending tens of thousands of messages at once is a good idea or if we should create chunks. And it is unclear what the remaining bottleneck is. Should we optimize the Python code, the payload or the JavaScript code on the client? Maybe combining multiple steps for creating a 3D object (8 at the moment) into one function call would also be a reasonable improvement.

@falkoschindler falkoschindler added the enhancement New feature or request label May 4, 2024
@falkoschindler falkoschindler self-assigned this May 4, 2024
@kovalp
Copy link

kovalp commented May 5, 2024

Let's see if I manage to test this...

@kovalp
Copy link

kovalp commented May 5, 2024

I tested this change. It is a good move for a few reasons.

  • the development version produces no flickering in Firefox and Chrome.
  • the version in the main branch when viewed from Firefox produces a not completely filled square in many cases, while the version in the development branch always produced the expected field of boxes.

On the downside, the development version on Firefox results in a message "This page slows down the browser" with the button "Close".

@falkoschindler
Copy link
Contributor Author

Yes, processing all these messages takes a while, which freezes the browser for a short while.
In PR #3022 I'm experimenting with another promising approach to speed up the initialization of large 3D scenes.

@falkoschindler falkoschindler changed the title Improve performance of 3D scene by sending multiple messages at once Improve performance of 3D scenes by sending multiple messages at once May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants