setInterval(()=>null,0) makes any animation much smoother
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- android, javascript
- Ambito
- mobile-dev, performance
Direzione di ricerca
Inizia riproducendo il NativeScript Playground collegato su Android con Profile GPU rendering abilitato, confrontando la schermata vuota, setInterval(..., 0) e i casi Choreographer.postFrameCallback. Poi traccia i punti di ingresso della pianificazione del runtime Android per setInterval e Choreographer; il lavoro è completato quando la differenza nella frequenza dei fotogrammi è stata spiegata o corretta e il confronto è stato verificato sui dispositivi indicati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- CLI: 6.1.2
- Android Runtime: 6.0.2 / 6.1.2
Describe the bug
I'm working on custom animation (screen blinking at 60fps) on Android, and I was very surprised that using of stupid setInterval(() => {...}, 0) works much better that the native android's Choreographer.
With setInterval(() => {...}, 0) I've got stable 60 FPS even on android 5 devices, but with Choreographer (that should work much efficiency, code below) I got drops to 50 FPS on powerful OnePlus 6 on Android 9.0
android.view.Choreographer.getInstance().postFrameCallback(...);
But if I write down setInterval(() => null); near the Choreographer callback definition - I will achieve stable FPS and low GPU utilisation (LOL, right?).
To Reproduce
I have created app on playground where everybody can test it. Turn on 'Profile GPU rendering' - 'On screen as bars' in 'developer options' menu and launch this simple app with simple loader on 2 pages - one with absolutely empty component, another one with setInterval(() => {}, 0) in OnInit.
Sample project
Nativescript Playground
Additional context
I've recorded animations to demonstrate this behaviour Imgur
And my question on StackOverflow (without any answer) link
- Lingua principale
- C++
- Stelle
- 563
- Fork
- 144
- Merge medio
- 10h 46m
- PR unite (30g)
- 14
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NativeScript/android
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
NativeScript/android#2039 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
NativeScript/android#2024 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
NativeScript/android#2020 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
NativeScript/android#2019 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
NativeScript/android#1986 ·
Tutte le issue di NativeScript/android
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
automated-analysis bug memory-safety
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
gazebosim/gz-sensors#662 · 1 commento ·