Uh oh!
There was an error while loading. Please reload this page.
src: use constant strings for memory info names - #46087
Merged
Merged
Conversation
nodejs-github-bot
commented
Jan 4, 2023
Collaborator
Review requested:
|
ShogunPanda
approved these changes
Jan 4, 2023
bnoordhuis
approved these changes
Jan 4, 2023
bnoordhuis
left a comment
Member
There was a problem hiding this comment.
LGTM, I think. It's hard to tell whether all names are indeed static strings and no real way to enforce that at compile time...
Comment on lines
+681
to
+683
| return std::string(MemoryInfoName()) + " (" + | ||
| std::to_string(env()->thread_id()) + ":" + | ||
| std::to_string(static_cast<int64_t>(async_id_)) + ")"; |
Member
There was a problem hiding this comment.
Something like this would be a little more efficient (fewer allocations):
Suggested change
| return std::string(MemoryInfoName()) + " (" + | |
| std::to_string(env()->thread_id()) + ":" + | |
| std::to_string(static_cast<int64_t>(async_id_)) + ")"; | |
| char buf[64]; | |
| snprintf(buf, sizeof(buf), "%s(%" PRIu64 ":%.0f)", | |
| MemoryInfoName(), env()->thread_id(), async_id_); | |
| return buf; |
Member
There was a problem hiding this comment.
I wouldn’t worry about efficiency for debug-only code too much.
MemberAuthor
There was a problem hiding this comment.
Yeah, diagnostic_name() is only invoked on debug logs.
MemberAuthor
There was a problem hiding this comment.
Updated with suggestion applied.
RaisinTen
approved these changes
Jan 4, 2023
tniessen
approved these changes
Jan 4, 2023
cjihrig
approved these changes
Jan 4, 2023
nodejs-github-bot
commented
Jan 5, 2023
Collaborator
jasnell
approved these changes
Jan 5, 2023
nodejs-github-bot
commented
Jan 9, 2023
Collaborator
Landed in 80fa25b |
RafaelGSS pushed a commit
to RafaelGSS/node
that referenced
this pull request
Jan 17, 2023
PR-URL: nodejs#46087 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
RafaelGSS pushed a commit
that referenced
this pull request
Jan 20, 2023
PR-URL: #46087 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Merged
juanarbol pushed a commit
that referenced
this pull request
Jan 26, 2023
PR-URL: #46087 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Merged
juanarbol pushed a commit
that referenced
this pull request
Jan 31, 2023
PR-URL: #46087 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v8::EmbedderGraph::Node::Name()expects constant strings. There is no need fornode::MemoryRetainer::MemoryInfoName()to return a copy of the name string when building an embedder graph for heap snapshots.