Title: Deprecate the profilerOutputDir profiler and name Java members in V8/DevTools profiles · Issue #2100 · NativeScript/android · GitHub
Open Graph Title: Deprecate the profilerOutputDir profiler and name Java members in V8/DevTools profiles · Issue #2100 · NativeScript/android
X Title: Deprecate the profilerOutputDir profiler and name Java members in V8/DevTools profiles · Issue #2100 · NativeScript/android
Description: Is your feature request related to a problem? Please describe. The runtime ships a legacy profiler, added in 2016 (d81045c), next to the Chrome DevTools profiler: Profiler.cpp always installs three globals: __startCPUProfiler(name) and _...
Open Graph Description: Is your feature request related to a problem? Please describe. The runtime ships a legacy profiler, added in 2016 (d81045c), next to the Chrome DevTools profiler: Profiler.cpp always installs three...
X Description: Is your feature request related to a problem? Please describe. The runtime ships a legacy profiler, added in 2016 (d81045c), next to the Chrome DevTools profiler: Profiler.cpp always installs three...
Opengraph URL: https://github.com/NativeScript/android/issues/2100
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate the profilerOutputDir profiler and name Java members in V8/DevTools profiles","articleBody":"**Is your feature request related to a problem? Please describe.**\n\nThe runtime ships a legacy profiler, added in 2016 (d81045c76), next to the Chrome DevTools profiler:\n\n- `Profiler.cpp` always installs three globals:\n - `__startCPUProfiler(name)` and `__stopCPUProfiler(name)` wrap V8's `CpuProfiler`, and stopping writes `\u003cprofilerOutputDir>/\u003capp>-\u003cname>-\u003ctime>.cpuprofile`.\n - `__heapSnapshot()` writes a `.heapsnapshot` file to the same directory.\n- Setting `android.profilerOutputDir` also turns on `MetadataNode::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's `prototype.constructor` is the inner function, not the class the app sees.\n\nAs far as I can tell nobody uses it:\n- nothing in core, the CLI, the plugins or angular sets `profilerOutputDir`;\n- with the default empty value, `Write` builds a path at `/` and fails, so the globals produce nothing unless the option is set.\n\nThe 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`.\n\nThe 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.\n\n**Describe the solution you'd like**\n\n1. **Deprecate the legacy profiler.**\n - Log a deprecation warning when `profilerOutputDir` is set.\n - Remove `MetadataNode::Wrap` and `s_profilerEnabled` in the next major release.\n - Decide what happens to `__startCPUProfiler`/`__stopCPUProfiler`/`__heapSnapshot`, and to core's `startCPUProfile`/`stopCPUProfile`:\n - remove them along with the profiler;\n - or keep them as thin helpers that write to the app's files directory by default, for profiling a release build without an inspector.\n - Deprecate `profilerOutputDir` in core's config types and the CLI's typings at the same time.\n2. **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:\n - Java class constructors (`FunctionTemplate::SetClassName` is already set to the dotted Java name);\n - instance and static methods (prototype template functions);\n - field accessors and static members;\n - functions created by `extend` and interface implementations.\n\n 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`.\n - Optionally, label the time spent in the JS↔Java bridge: callback dispatch from Java, argument conversion and `ObjectManager` wrapper 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.\n\n**Describe alternatives you've considered**\n\n- Keep the profiler as is. It costs little at runtime when off: `Wrap` returns the function unchanged unless `profilerOutputDir` is set. But it is unmaintained, undocumented, and has semantic quirks when on.\n- 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.\n\n**Additional context**\n\nThis 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.\n","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-11-10T20:11:07Z","url":"https://github.com/NativeScript/android/issues/2100"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e3cdfd77-afe9-9e02-90d0-5a178c8889ed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9226:38E318:9DBBE1:C6C9C1:6B012837 |
| html-safe-nonce | bc772d4e474d32ce82f34b20a8649b6de4ec77c76e8ed610f40739082fd98f6d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjI2OjM4RTMxODo5REJCRTE6QzZDOUMxOjZCMDEyODM3IiwidmlzaXRvcl9pZCI6IjQwMzMyNzY2Nzk5MTE3MTI4MjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9d70d7a4b2f992c06cf5a6367d08d7ba87ada4c35ddeed752d2afb164c198753 |
| hovercard-subject-tag | issue:6314947694 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/android/2100/issue_layout |
| twitter:image | https://opengraph.githubassets.com/20de3c32a435061b6f7ee3a40e881763c72af9f42480602bd3737fe9b35b1288/NativeScript/android/issues/2100 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/20de3c32a435061b6f7ee3a40e881763c72af9f42480602bd3737fe9b35b1288/NativeScript/android/issues/2100 |
| og:image:alt | Is your feature request related to a problem? Please describe. The runtime ships a legacy profiler, added in 2016 (d81045c), next to the Chrome DevTools profiler: Profiler.cpp always installs three... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | edusperoni |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/android git https://github.com/NativeScript/android.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 29137950 |
| octolytics-dimension-repository_nwo | NativeScript/android |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29137950 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/android |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width