Skip to content
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

src: fix performance-faster-string-find in node_report.cc #27262

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ static void PrintJavaScriptStack(JSONWriter* writer,
String::Utf8Value sv(isolate, stackstr);
ss = std::string(*sv, sv.length());
}
int line = ss.find("\n");
int line = ss.find('\n');
if (line == -1) {
writer->json_keyvalue("message", ss);
writer->json_objectend();
Expand All @@ -349,15 +349,15 @@ static void PrintJavaScriptStack(JSONWriter* writer,
writer->json_keyvalue("message", l);
writer->json_arraystart("stack");
ss = ss.substr(line + 1);
line = ss.find("\n");
line = ss.find('\n');
while (line != -1) {
l = ss.substr(0, line);
l.erase(l.begin(), std::find_if(l.begin(), l.end(), [](int ch) {
return !std::iswspace(ch);
}));
writer->json_element(l);
ss = ss.substr(line + 1);
line = ss.find("\n");
line = ss.find('\n');
}
}
writer->json_arrayend();
Expand Down