Running some native code for the first time results in application lag
@triniwiz arbeitet bereits daran.
Seit 08.9.2021.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 5.3.0
- Cross-platform modules: 5.3.1
- Android Runtime: 5.2.x and 5.3.0 tested
Describe the bug
When using trying to use some android variables or instantiate some instances, the first call will have a heavy delay (500-600ms on a Galaxy S8).
Using the playground, reading android.R.integer.config_shortAnimTime, android.R.attr.state_pressed and android.R.attr.state_enabled all caused a delay, which froze the UI.
Downloading the project and using NS 5.3, calling nativeView.getContext().getResources().getInteger also called a delay and freeze. Edit: Running with --bundle shortens this delay for some reason (takes something like 30-40ms)
This freeze happens only on the first time the code is run, after that it takes less than 10ms.
To Reproduce
Measure how long it takes to call:
const t = android.R.integer.config_shortAnimTime; // should take long on first time
nativeView.getContext().getResources().getInteger(t); // should take long on first time in 5.3
Expected behavior
These calls should behave on the first time as they do on the second and onward.
Sample project
https://play.nativescript.org/?template=play-ng&id=28zxPb&v=6
Additional context
We discovered it by https://github.com/JoshDSommer/nativescript-ngx-shadow/issues/16
- Vorherrschende Sprache
- C++
- Sterne
- 563
- Forks
- 144
- Ø Merge
- 10 Std. 46 Min.
- Gemergte PRs (30 T.)
- 14
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NativeScript/android
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
NativeScript/android#2039 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
NativeScript/android#2024 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
NativeScript/android#2020 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 42/100
NativeScript/android#2019 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
NativeScript/android#1986 ·
Alle Issues in NativeScript/android
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 92/100
autowarefoundation/autoware_universe#13413 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
automated-analysis bug memory-safety
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
gazebosim/gz-sensors#662 · 1 Kommentar ·