Use the Vector/HeapVector projection constructor. [chromium/src : main]

0 views
Skip to first unread message

Michael Lippautz (Gerrit)

unread,
Mar 23, 2026, 4:34:49 AM (8 days ago) Mar 23
to Steinar H Gunderson, Anton Bikineev, Anders Hartvoll Ruud, chrom...@appspot.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Kentaro Hara, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org
Attention needed from Anders Hartvoll Ruud and Steinar H Gunderson

Michael Lippautz voted and added 1 comment

Votes added by Michael Lippautz

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Michael Lippautz . resolved

lgtm, constructing with the right size is the cheapest primitive for the GC

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Steinar H Gunderson
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5b4cc0ab4398166d8c838c99a919be9cb3746090
Gerrit-Change-Number: 7685992
Gerrit-PatchSet: 2
Gerrit-Owner: Steinar H Gunderson <se...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Anton Bikineev <biki...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Attention: Steinar H Gunderson <se...@chromium.org>
Gerrit-Comment-Date: Mon, 23 Mar 2026 08:34:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Anders Hartvoll Ruud (Gerrit)

unread,
Mar 23, 2026, 5:29:33 AM (8 days ago) Mar 23
to Steinar H Gunderson, Michael Lippautz, Anton Bikineev, chrom...@appspot.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Kentaro Hara, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org
Attention needed from Steinar H Gunderson

Anders Hartvoll Ruud voted and added 1 comment

Votes added by Anders Hartvoll Ruud

Code-Review+1

1 comment

Patchset-level comments
Anders Hartvoll Ruud . resolved

👍

Open in Gerrit

Related details

Attention is currently required from:
  • Steinar H Gunderson
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5b4cc0ab4398166d8c838c99a919be9cb3746090
Gerrit-Change-Number: 7685992
Gerrit-PatchSet: 2
Gerrit-Owner: Steinar H Gunderson <se...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Anton Bikineev <biki...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Steinar H Gunderson <se...@chromium.org>
Gerrit-Comment-Date: Mon, 23 Mar 2026 09:29:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Steinar H Gunderson (Gerrit)

unread,
Mar 23, 2026, 5:33:34 AM (8 days ago) Mar 23
to Anders Hartvoll Ruud, Michael Lippautz, Anton Bikineev, chrom...@appspot.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Kentaro Hara, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org

Steinar H Gunderson voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5b4cc0ab4398166d8c838c99a919be9cb3746090
Gerrit-Change-Number: 7685992
Gerrit-PatchSet: 2
Gerrit-Owner: Steinar H Gunderson <se...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Steinar H Gunderson <se...@chromium.org>
Gerrit-CC: Anton Bikineev <biki...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Comment-Date: Mon, 23 Mar 2026 09:33:23 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Chromium LUCI CQ (Gerrit)

unread,
Mar 23, 2026, 6:24:23 AM (8 days ago) Mar 23
to Steinar H Gunderson, Anders Hartvoll Ruud, Michael Lippautz, Anton Bikineev, chrom...@appspot.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Kentaro Hara, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, oilpan-rev...@chromium.org

Chromium LUCI CQ submitted the change

Change information

Commit message:
Use the Vector/HeapVector projection constructor.

Vector and HeapVector have grown a new constructor that take in a
range and a projection (a lambda), effectively creating the vector
in one go. (Actually HeapVector's was limited to other HeapVectors,
but we extend it to the same Range lambda as Vector.) This replaces
our previous pattern of ReserveInitialCapacity and repeated
push_back (or AppendUnchecked):

- It is safer, as there is no way to reserve a different number of
elements from the number you AppendUnchecked, and because it
naturally lends itself to spanification of the input data.

- It generates less code, since HeapVector does not need barriers
in this case (the constructed object is guaranteed to never
leave the stack while we are pushing the elements). It also does
not need any bounds-checking.

- It is also possibly marginally faster, again due to the above.
However, the effect is very slight; on Speedometer3, it is either
neutral or very weakly positive.

The aesthetics are debatable, but overall it seems mostly fine to me,
so we use it for all relevant CSS loops that I could find, by grepping
for ReserveInitialCapacity. (The primary missing cases are the ones
where we need a filter, so that we don't actually end up pushing
as many elements as we assume we will.)
Change-Id: I5b4cc0ab4398166d8c838c99a919be9cb3746090
Reviewed-by: Anders Hartvoll Ruud <and...@chromium.org>
Reviewed-by: Michael Lippautz <mlip...@chromium.org>
Commit-Queue: Steinar H Gunderson <se...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1603351}
Files:
  • M third_party/blink/renderer/core/css/basic_shape_functions.cc
  • M third_party/blink/renderer/core/css/css_basic_shape_values.cc
  • M third_party/blink/renderer/core/css/css_property_value_set.cc
  • M third_party/blink/renderer/core/css/css_scope_rule.cc
  • M third_party/blink/renderer/core/css/resolver/matched_properties_cache.cc
  • M third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
  • M third_party/blink/renderer/platform/heap/collection_support/heap_vector.h
Change size: M
Delta: 7 files changed, 65 insertions(+), 83 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Anders Hartvoll Ruud, +1 by Michael Lippautz
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5b4cc0ab4398166d8c838c99a919be9cb3746090
Gerrit-Change-Number: 7685992
Gerrit-PatchSet: 3
Gerrit-Owner: Steinar H Gunderson <se...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages