-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v8: GetCpuProfiler is going away soon #18039
Comments
/cc @nodejs/v8 |
Hmm.. with the new API it seems that it should be possible to create multiple instances of the CPU profiler. Previously it was a singleton. This means that user-space modules could all use different profilers, and the idle notification above would stop working. Does this mean that Node needs to instantiate a singleton profiler and the ecosystem needs to change to start using that? |
Yes, with the old API, every isolate has one profiler assigned, created during Node could instantiate a singleton and provide that - or maybe we should invert dependencies: Addons can use as many profilers as they want, but they are responsible for registering for the IdleNotifier. |
Replace `v8::Isolate::GetCpuProfiler()` with `v8::CpuProfiler::New()` and cache the instance; creating and disposing an instance every loop tick is too expensive. Fixes: nodejs#18039
I don't think we have to worry about that. We only use it to call I've opened #18534 with a simple fix. |
And https://chromium-review.googlesource.com/c/v8/v8/+/900622 to discuss simplifying the API. |
Replace `v8::Isolate::GetCpuProfiler()` with `v8::CpuProfiler::New()` and cache the instance; creating and disposing an instance every loop tick is too expensive. PR-URL: nodejs#18534 Fixes: nodejs#18039 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Replace `v8::Isolate::GetCpuProfiler()` with `v8::CpuProfiler::New()` and cache the instance; creating and disposing an instance every loop tick is too expensive. Backport-PR-URL: #18959 PR-URL: #18534 Fixes: #18039 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
The VM state is a property of the isolate, not the CPU profiler. Having to create a v8::CpuProfiler instance in order to change the property is somewhat inefficient. See nodejs/node#18039 and nodejs/node#18534 for context. Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I70e31deca6529bccc05a0f4ed500ee268fb63cb8 Reviewed-on: https://chromium-review.googlesource.com/900622 Commit-Queue: Yang Guo <yangguo@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#51779}
Replace `v8::Isolate::GetCpuProfiler()` with `v8::CpuProfiler::New()` and cache the instance; creating and disposing an instance every loop tick is too expensive. PR-URL: nodejs#18534 Fixes: nodejs#18039 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
A new API was introduced in v8/v8@120b753.
The current API is deprecated in V8 6.4: v8/v8@8c5e2d7
Our usage:
node/src/env.cc
Lines 150 to 160 in 6aac05b
The text was updated successfully, but these errors were encountered: