On first open, CPU stays spiked until variables are updated #619
-
Hi. Sorry if I am using polling variables or run-while incorrectly. As an example, these variables poll every 0s when the slider is visible (showBrightness) and use ~5% CPU when constantly polling. Almost no CPU is used when the widget is not visible.
However when the window containing this widget is first launched - showBrightness is false, the slider is hidden, therefore neither variable should be polling - it uses 5% CPU as if it were open. Updating showBrightness to true and then back to false instantly drops CPU back to the expected idle level. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Tbh the solution is probably to not use 0s defpolls, these are pretty much never a good idea (spawning at least 3 different processes several times per second, commands aren't as fast as calling a function in a programming language). Why do you need it for exactly? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the pointer - updating the slider variables (volume, brightness) on keypress accomplishes the same smooth scrolling effect. |
Beta Was this translation helpful? Give feedback.
Tbh the solution is probably to not use 0s defpolls, these are pretty much never a good idea (spawning at least 3 different processes several times per second, commands aren't as fast as calling a function in a programming language). Why do you need it for exactly?