You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In fact, I think this is because when obtaining loactions during Takesnapshot, GetLineNumber / GetColumnNumber will trigger too many GetPositionInfoSlow in some cases.
voidV8HeapExplorer::ExtractLocationForJSFunction(HeapEntry* entry,
JSFunction func) {
if (!func.shared().script().IsScript()) return;
Script script = Script::cast(func.shared().script());
int scriptId = script.id();
int start = func.shared().StartPosition();
int line = script.GetLineNumber(start);
int col = script.GetColumnNumber(start);
snapshot_->AddLocation(entry, scriptId, line, col);
}
as
voidV8HeapExplorer::ExtractLocationForJSFunction(HeapEntry* entry,
JSFunction func) {
if (!func.shared().script().IsScript()) return;
Script script = Script::cast(func.shared().script());
int scriptId = script.id();
int start = func.shared().StartPosition();
// this is for setting script line ends before getting script position info to// prevent fallback to GetPositionInfoSlow.
i::Handle<i::Script> script2(i::Script::cast(script), func.shared().GetIsolate());
int line = script.GetLineNumber(script2, start);
int col = script.GetColumnNumber(script2, start);
snapshot_->AddLocation(entry, scriptId, line, col);
}
@hyj1991 Fixes to V8 should be sent to the upstream project (see https://v8.dev/docs/contribute) but if it's strictly a performance improvement (no observable changes except speed), it'll almost certainly get accepted.
We can back-port the change to Node.js after it's merged upstream.
Activity
hyj1991 commentedon Aug 18, 2020
In fact, I think this is because when obtaining
loactionsduringTakesnapshot,GetLineNumber/GetColumnNumberwill trigger too many GetPositionInfoSlow in some cases.hyj1991 commentedon Aug 18, 2020
Could we change the ExtractLocationForJSFunction
as
to speed up
TakeSnapshot?bnoordhuis commentedon Aug 18, 2020
@hyj1991 Fixes to V8 should be sent to the upstream project (see https://v8.dev/docs/contribute) but if it's strictly a performance improvement (no observable changes except speed), it'll almost certainly get accepted.
We can back-port the change to Node.js after it's merged upstream.
hyj1991 commentedon Aug 19, 2020
https://chromium-review.googlesource.com/c/v8/v8/+/2362413
gengjiawen commentedon Sep 7, 2021
I get an graphql application with 300mb memory takes 50m to get the result ...
Trott commentedon Sep 20, 2021
I'm going to optimistically close this, but if that's wrong and there's still an issue here in Node.js, please comment or re-open. Thanks!