jupyter-widgets-contrib / ipygany

3-D Scientific Visualization in the Jupyter Notebook
BSD 3-Clause "New" or "Revised" License
487 stars 53 forks source link

CPU usage and scene idle #91

Open benbovy opened 3 years ago

benbovy commented 3 years ago

I noticed that CPU usage increases significantly (+ 20%) when the scene is shown on the screen (active tab), even when I'm not interacting with it at all (nor playing any animation). When multiple scenes (or scene views) are created in a notebook, fans are running high.

Tested on both Firefox and Chrome, on a MacBook Pro 13-inch, 2019 (MacOS Mojave). I'm using a 4k screen.

Out of curiosity, I've checked some examples from https://threejs.org/examples. Some of them seem to use a lot of CPU (especially animations), while others (static) don't use much CPU when not interacting with it.

martinRenou commented 3 years ago

I wonder what happens if you take a ThreeJS example containing a more refined mesh. If the CPU usage is high, I suspect it's because you don't have a dedicated GPU but are using an integrated one.

benbovy commented 3 years ago

If the CPU usage is high, I suspect it's because you don't have a dedicated GPU but are using an integrated one.

Yes that's an integrated one. I'm not very surprised that CPU usage would quickly increase in that case, but I was wondering what could use CPU (or GPU) resources when the ipygany scene is in an apparent "idle" stage.

benbovy commented 3 years ago

I wonder what happens if you take a ThreeJS example containing a more refined mesh.

For my use case (3D terrain visualization) I could also try the other way around, e.g., using something like pydelatin on the server side. It would also optimize data transfer. It might be tricky to compute an optimal, fixed mesh on time-dependent evolving terrain data, though.