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
binding_refresh_interval not having any impact #57
Comments
As far as I can tell, from nicegui import ui
class Model:
def __init__(self):
self.x = 1
model = Model()
ui.number('x').bind_value_from(model, 'x')
ui.run(binding_refresh_interval=0.5) There is probably something else CPU-intensive going on in your code. Can you boil it down to some minimum example? |
I think what I'm seeing is essentially the minimum CPU usage from NiceGUI. In other words, using your very minimal example, I see roughly 50% CPU usage on one of the RPi's cores. Changing the binding_refresh_interval has no impact. What's interesting is that I can run JustPy, using the example at the end of https://justpy.io/tutorial/model_and_data/, which is also doing bind operations, and it runs with less than 5% CPU usage on one core. Please understand this isn't a knock against NiceGUI, since it has a much more "batteries included" approach, which I can appreciate. But a 10x increase in CPU usage seems excessive, and I wonder if there's something I'm missing. |
We will run our examples on an RPi in the next days and come back to you. |
I'm running my nicegui on the Beaglebone Black single board computer, it has one CPU core and it uses 20% give or take. |
I just checked the CPU usage on a Raspberry Pi 3 Model B V1.2 (2015) with a simple hello-world script: from nicegui import ui
ui.label('Hello world!')
ui.run() Here are my conclusions:
So if you don't need auto-reload, set it to Note that changes to the arguments of |
You nailed it, @falkoschindler. I had my venv in the same folder as my test script. Changing reload to False lowered CPU to around 1%, as did moving the script to its own folder (keeping reload=True). |
In my case, running it on Beaglebone Black, changing refresh interval from 0.1 to 0.5 lowered CPU load from 60% to 10% approximately. I mean I ran my large script for UI, not the "hello world" script. |
Running on a Raspberry Pi, NiceGUI is fairly CPU intensive (although still usable). I tried changing the binding_refresh_interval value, via a ui.run() parameter, but it doesn't seem to make any difference on CPU usage.
The text was updated successfully, but these errors were encountered: