-
Notifications
You must be signed in to change notification settings - Fork 89
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
Slower UI when adding lua widgets #4572
Comments
Do you have any other script than those 2 ones? |
I also have a F3K template for 4servos wing where it is even worse (probably due to additional mixes and curves for calibration). |
Please provide a "minimal" ZIP with everything needed to reproduce the problem, I will have a look tomorrow. |
Thanks for your support.
You should notice the difference in UI speed between the 3 versions. Setup instructions are available on the repo if needed > https://github.com/neuhausj/Ethos-resources |
Indeed the UI becomes slow. I wonder why there are debug traces such as "wakeup" or "paint". |
I tried to optimize my 2 widgets as much as possible yesterday and used some print to check how quickly those were called. Even calling them slower didn’t help. You can replace the 2 widgets with the one from the repository (they don’t have the print active): https://github.com/neuhausj/Ethos-resources |
Are you sure that this compilation chain optimizes speed? I am not so sure. I have removed it here, removed the debug and removed the errors and it is already quicker. I work with the 6S template which you consider as the worst one, right? |
I think it helped, yes. The same approach was used for other scripts (elrs) and on EdgeTX as well iirc. My initial approach was to just use a single main function. I have it versioned here if you want to check > https://github.com/neuhausj/Ethos-resources/tree/107c7c96de047d1e6dd520ce87a1a36c6e0c3278 |
I also tried using completely empty widgets (all code in paint and wakeup commented), and the radio was also getting slower. |
I think I have found the problem: to allow the Lua scripts to access his resources at any time, Ethos does a chdir into the script directory. It does this on each wakeup, on each paint, etc. Then at the end of all those functions, it chdir into the previous directory (you could be navigating inside System / File Manager ...) And the problem I just discovered is ... it costs 6ms on each call. So 12ms per wakeup. Plus another 12ms in case you need to paint something. You have 6 widgets ... the UI responsiveness will be killed. I will find another solution before the next nightlies. |
This is very nice hear ! Thank you for the debugging. |
Wow, seems a solution could really improve overall performance in case you 've several widgets active ! ... would have thought that the "global declaration" of the class which is used in every handler could have caused a slighty performance penalty, but not so much as mentioned..
why not declare |
The performance gain after my fix seems huge on my X20-PRO. I hope there is no regression with relative paths now! |
Please give it a test when the nightlies are out, thanks a lot! |
I wonder if it could be the same problem than #4374 |
@strgaltdel Don't hesite to give another test with this fix, I would like to close #4374 in the same shot ;) |
Hello, I also noticed the widget does not behave the same in the nightly vs stable version: in the stable version, the value of an inactive telemetry value (without connection) is 0 vs nil in the nightlies (hence I added a check in the latest version). And the speed doesn't seem to change when both widgets have an empty paint and wakeup functions. Also thanks strgaltdel for the tip, I updated both widgets to use a local variable, but it doesn't seem to improve much. |
@neuhausj I have just started the nightly. It cannot be fixed in all firmware compiled before this comment has been written :) |
My bad !! |
Just quick update: I tried the latest nightly and the speed is great! You can hardly distinguish this from a model without widgets. |
Hello,
As part of the creation of my F3k template, I made 2 simple widgets to display a status and a nicer battery widget. (available here > https://github.com/neuhausj/Ethos-resources )
However, the whole radio is becoming a lot less responsive with these 6 lua widgets, and for each widget removed, the whole radio is speeding up again.
How can the UI responsiveness be improved? Why the whole system is getting slower? (also the system/model menus)
When loading a new model without any widget, the radio is fast again, so it definetely comes from the lua widgets.
I am using these 2 pages, with each 3 lua widgets on it:
The idea is to keep track of the voltages and radio status easily.
Flight view: activated after launch
Flight summary: activated after landing
What I tried:
This was tested on both a X18SE and a X20Pro with latest firmware:
Thanks in advance for the support.
The text was updated successfully, but these errors were encountered: