Deprecate the profilerOutputDir profiler and name Java members in V8/DevTools profiles
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- android, cpp
- Ambito
- mobile, performance
Direzione di ricerca
Start by reading Profiler.cpp, MetadataNode::Wrap, and the core and CLI declarations for profilerOutputDir; the issue also points to @nativescript/core/profiling and the follow-up to #2099. Compare DevTools profiles for the listed Java constructors, methods, fields, and functions created by extend or interface implementations, then review V8's naming APIs. Done means the legacy profiler's deprecation or removal path is resolved and Java members have useful profile names; the issue leaves API compatibility decisions open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
The runtime ships a legacy profiler, added in 2016 (d81045c76), next to the Chrome DevTools profiler:
Profiler.cppalways installs three globals:__startCPUProfiler(name)and__stopCPUProfiler(name)wrap V8'sCpuProfiler, and stopping writes<profilerOutputDir>/<app>-<name>-<time>.cpuprofile.__heapSnapshot()writes a.heapsnapshotfile to the same directory.
- Setting
android.profilerOutputDiralso turns onMetadataNode::Wrap. That compiles a named JS wrapper around every Java class constructor and every Java method (function getAlpha() { return getAlpha.__func.apply(this, arguments); }) so that profiles show Java member names. The wrappers add a JS frame to every call and replace the functions apps see. In that mode a wrapper'sprototype.constructoris the inner function, not the class the app sees.
As far as I can tell nobody uses it:
- nothing in core, the CLI, the plugins or angular sets
profilerOutputDir; - with the default empty value,
Writebuilds a path at/and fails, so the globals produce nothing unless the option is set.
The only consumers I found are @nativescript/core/profiling's startCPUProfile/stopCPUProfile, which call these globals on Android, and the profilerOutputDir entries in core's config.interface.ts and the CLI's project.d.ts.
The DevTools CPU and heap profilers cover the same ground through the inspector, with a better workflow. The one thing the legacy profiler does that they don't is to start and stop from app code with no inspector attached.
Describe the solution you'd like
-
Deprecate the legacy profiler.
- Log a deprecation warning when
profilerOutputDiris set. - Remove
MetadataNode::Wrapands_profilerEnabledin the next major release. - Decide what happens to
__startCPUProfiler/__stopCPUProfiler/__heapSnapshot, and to core'sstartCPUProfile/stopCPUProfile:- remove them along with the profiler;
- or keep them as thin helpers that write to the app's files directory by default, for profiling a release build without an inspector.
- Deprecate
profilerOutputDirin core's config types and the CLI's typings at the same time.
- Log a deprecation warning when
-
Make V8/DevTools profiles more informative instead. Java members should show up under useful names in a DevTools CPU profile without wrapper functions. Start by checking what a profile shows today for:
- Java class constructors (
FunctionTemplate::SetClassNameis already set to the dotted Java name); - instance and static methods (prototype template functions);
- field accessors and static members;
- functions created by
extendand interface implementations.
Then fill the gaps with V8's naming APIs:
FunctionTemplate::SetClassName,Function::SetName, or naming the template functions after their property keys. Where a name alone is ambiguous across overloads or same-named methods of different classes, include the declaring class, e.g.android.view.View.getAlpha.- Optionally, label the time spent in the JS↔Java bridge: callback dispatch from Java, argument conversion and
ObjectManagerwrapper creation. A DevTools profile could then tell bridge overhead apart from app JS. V8's CPU profiler supports embedder states and trace events that could carry this.
- Java class constructors (
Describe alternatives you've considered
- Keep the profiler as is. It costs little at runtime when off:
Wrapreturns the function unchanged unlessprofilerOutputDiris set. But it is unmaintained, undocumented, and has semantic quirks when on. - Keep only the wrapper naming. It changes the functions apps see and adds a frame per call, so it distorts the very profiles it is meant to label.
Additional context
This came up while optimizing JS wrapper creation for Java objects, in the follow-up to #2099. Dropping a wrapper's own constructor property only made a difference in this profiler mode, where wrapper.constructor now resolves to the inner, unwrapped constructor, as new-created instances already did.
- Lingua principale
- C++
- Stelle
- 565
- Fork
- 147
- Merge medio
- 1g 2h
- PR unite (30g)
- 27
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi 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à 4/5 3-5 giorni Idoneità per principianti 48/100
NativeScript/android#2107 ·
I maintainer di solito rispondono entro 1 giorno
-
ErrorReportActivity draws under the status bar on targetSdk 35 (forced edge-to-edge)Forse già presa @aleclarson l’ha presa 48 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
NativeScript/android#2053 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
NativeScript/android#2039 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
NativeScript/android#2024 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
NativeScript/android#2020 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NativeScript/android
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
phantoslayer21/wronggpu#275 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
ReyeMe/SaturnRingLib#155 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Nheko-Reborn/nheko#2092 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
isocpp/CppCoreGuidelines#2345 ·