Lua runs every vsync while the window has focus, even when idle
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Domaine
- desktop, performance
Piste de recherche
Start with the main loop in engine/system/win/sys_main.cpp, ui_main_c::Frame in ui_main.cpp, and frame elision in engine/render/r_main.cpp; then trace GLFW callbacks and texture worker handoffs in engine/system/win/sys_video.cpp and engine/render/r_texture.cpp. Check how #110's condition variable change works and how Lua-driven caret blinking, toasts, and jewel animations request regular frames. Done means idle focused windows avoid running Lua and swapping at every vsync while inputs, worker results, and animations still update.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
While PoB has focus, OnFrame runs every vsync even when nothing changes. The main loop only waits when minimized (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/system/win/sys_main.cpp#L697-L704), and ui_main_c::Frame only sleeps when the window is unfocused (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/ui_main.cpp#L389-L391 and https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/ui_main.cpp#L435-L437). Frame elision skips drawing the layers (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/render/r_main.cpp#L1209-L1240), but Lua, the blit and the swap still run every frame. On a 144 Hz screen that's 144 Lua frames a second for an idle window.
I know running Lua only when something happens is on your list. These are the places I think it would touch:
- The elision hash could double as an idle detector. After a few identical frames with no input, no subscript, no running coroutine and no pending texture, the loop could switch from
glfwPollEventstoglfwWaitEventsTimeout. - The GLFW callbacks would set a dirty flag. The cursor callback already stores the position (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/system/win/sys_video.cpp#L487-L494).
- Workers would call
glfwPostEmptyEvent()when they hand something to the main thread: subscript messages, and texture uploads (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/render/r_texture.cpp#L184-L188). - The texture workers spin on
Sleep(1)while idle (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/render/r_texture.cpp#L229). The condvar change from #110 (6a74097) already fixes that.
On the PoB side the caret blink, toasts and the rotating jewel rings need regular frames, so a timeout of a few hundred ms, or a way for Lua to ask for the next frame, would keep those working.
- Langage dominant
- C++
- Étoiles
- 23
- Forks
- 69
- Merge moyen
- 2 h 50 min
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic
-
Difficulté 4/5 3-5 jours Accessibilité débutants 38/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
-
Difficulté 4/5 1-2 jours Accessibilité débutants 48/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
Toutes les issues de PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic
Issues similaires
-
enhancement help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
-
difficulty:easy prio:normal type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
NatronGitHub/openfx-supportext#326 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
zucch1/android-auto-jetson#293 ·
Les mainteneurs répondent en général sous 1 jour
-
lfortran -E exits with status 0 after a C preprocessor error (#error, wrong macro argument count)Ouvertebug low priority preprocessor
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour
-
difficulty:easy enhancement prio:low
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
NatronGitHub/openfx-misc#502 ·
Les mainteneurs répondent en général sous 1 jour