Running some native code for the first time results in application lag
@triniwiz já está trabalhando nisso.
Desde 8/9/2021.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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
- Linguagem predominante
- C++
- Estrelas
- 563
- Forks
- 144
- Merge médio
- 10h 46min
- PRs com merge (30d)
- 14
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de NativeScript/android
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 38/100
NativeScript/android#2039 · 1 comentário ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
NativeScript/android#2024 ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
NativeScript/android#2020 ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 42/100
NativeScript/android#2019 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
NativeScript/android#1986 ·
Todas as issues de NativeScript/android
Issues semelhantes
-
Website Doc Typo Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 92/100
autowarefoundation/autoware_universe#13413 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
-
automated-analysis bug memory-safety
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100