Create a string_view instead of string from char*. [v8/v8 : main]

0 views
Skip to first unread message

Michael Lippautz (Gerrit)

unread,
Jan 7, 2026, 5:04:25 AM (2 days ago) Jan 7
to Jeffrey Yu, V8 LUCI CQ, Hannes Payer, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com
Attention needed from Jeffrey Yu

Michael Lippautz voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Jeffrey Yu
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 4
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Jeffrey Yu <yu...@chromium.org>
Gerrit-Comment-Date: Wed, 07 Jan 2026 10:04:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Darius Mercadier (Gerrit)

unread,
Jan 8, 2026, 3:09:48 AM (yesterday) Jan 8
to Jeffrey Yu, Michael Lippautz, V8 LUCI CQ, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com
Attention needed from Jeffrey Yu

Darius Mercadier voted and added 1 comment

Votes added by Darius Mercadier

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Darius Mercadier . resolved

stamp

Open in Gerrit

Related details

Attention is currently required from:
  • Jeffrey Yu
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 4
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Attention: Jeffrey Yu <yu...@chromium.org>
Gerrit-Comment-Date: Thu, 08 Jan 2026 08:09:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Jeffrey Yu (Gerrit)

unread,
Jan 8, 2026, 3:35:08 AM (yesterday) Jan 8
to Darius Mercadier, Michael Lippautz, V8 LUCI CQ, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com

Jeffrey Yu voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 4
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Thu, 08 Jan 2026 08:35:04 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

V8 LUCI CQ (Gerrit)

unread,
Jan 8, 2026, 4:25:02 AM (yesterday) Jan 8
to Jeffrey Yu, Darius Mercadier, Michael Lippautz, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com

V8 LUCI CQ submitted the change

Change information

Commit message:
Create a string_view instead of string from char*.

This avoids an unnecessary string copy.
Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Reviewed-by: Darius Mercadier <dmerc...@chromium.org>
Reviewed-by: Michael Lippautz <mlip...@chromium.org>
Commit-Queue: Jeffrey Yu <yu...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#104539}
Files:
  • M src/heap/cppgc/name-trait.cc
Change size: XS
Delta: 1 file changed, 5 insertions(+), 3 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Michael Lippautz, +1 by Darius Mercadier
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 5
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
open
diffy
satisfied_requirement

Clemens Backes (Gerrit)

unread,
Jan 8, 2026, 8:00:21 AM (22 hours ago) Jan 8
to Jeffrey Yu, V8 LUCI CQ, Darius Mercadier, Michael Lippautz, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com
Attention needed from Jeffrey Yu

Clemens Backes added 1 comment

File src/heap/cppgc/name-trait.cc
Line 34, Patchset 5 (Latest): const std::string name = std::string(raw.substr(start_pos, len));
Clemens Backes . unresolved

Nice change! Just saw it flying by, and was wondering why this still creates a `std::string` copy instead of using `string_view` as well?

Open in Gerrit

Related details

Attention is currently required from:
  • Jeffrey Yu
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 5
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Clemens Backes <clem...@chromium.org>
Gerrit-Attention: Jeffrey Yu <yu...@chromium.org>
Gerrit-Comment-Date: Thu, 08 Jan 2026 13:00:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
open
diffy

Jeffrey Yu (Gerrit)

unread,
Jan 8, 2026, 2:05:33 PM (16 hours ago) Jan 8
to V8 LUCI CQ, Clemens Backes, Darius Mercadier, Michael Lippautz, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com

Jeffrey Yu added 1 comment

File src/heap/cppgc/name-trait.cc
Line 34, Patchset 5 (Latest): const std::string name = std::string(raw.substr(start_pos, len));
Clemens Backes . resolved

Nice change! Just saw it flying by, and was wondering why this still creates a `std::string` copy instead of using `string_view` as well?

Jeffrey Yu

I wasn't sure whether it was safe to use a string_view to replace the second copy for use with snprintf. string_view doesn't have a `.c_str()` method, and `.data()` on string_view doesn't terminate with the null character.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 5
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Clemens Backes <clem...@chromium.org>
Gerrit-Comment-Date: Thu, 08 Jan 2026 19:05:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Clemens Backes <clem...@chromium.org>
satisfied_requirement
open
diffy

Clemens Backes (Gerrit)

unread,
3:44 AM (3 hours ago) 3:44 AM
to Jeffrey Yu, V8 LUCI CQ, Darius Mercadier, Michael Lippautz, dmercadi...@chromium.org, jgrube...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, pthier...@chromium.org, v8-re...@googlegroups.com

Clemens Backes added 1 comment

File src/heap/cppgc/name-trait.cc
Line 34, Patchset 5 (Latest): const std::string name = std::string(raw.substr(start_pos, len));
Clemens Backes . resolved

Nice change! Just saw it flying by, and was wondering why this still creates a `std::string` copy instead of using `string_view` as well?

Jeffrey Yu

I wasn't sure whether it was safe to use a string_view to replace the second copy for use with snprintf. string_view doesn't have a `.c_str()` method, and `.data()` on string_view doesn't terminate with the null character.

Clemens Backes

It looks like the whole point of the `snprintf` is to add the terminating null character. So you can replace it with a `memcpy` plus setting the last character to `'\0'` explicitly. That skips the intermediate copy via `std::string`.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Iafa461ab98fbc5eb171c4c6c8f55fb864b5e4a4f
Gerrit-Change-Number: 7361593
Gerrit-PatchSet: 5
Gerrit-Owner: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Jeffrey Yu <yu...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Clemens Backes <clem...@chromium.org>
Gerrit-Comment-Date: Fri, 09 Jan 2026 08:44:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jeffrey Yu <yu...@chromium.org>
Comment-In-Reply-To: Clemens Backes <clem...@chromium.org>
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages