Migrate HashingLRUCache to Abseil containers [chromium/src : main]

0 views
Skip to first unread message

Adam Rice (Gerrit)

unread,
Jun 22, 2026, 7:21:24 AM (11 days ago) Jun 22
to Daniel Cheng, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Daniel Cheng

Adam Rice added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Adam Rice . resolved

I want to switch to absl::flat_hash_map for the LRU cache in net::AddressSorterPosix to reduce the overhead on misses, but it's more efficient in terms of binary size to switch everything at once.

It doesn't appear to be possible to avoid the increase in source volume, but I limited it by splitting the lru_cache.h header into three parts.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not 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: If760289f525c32395638ffdfe5a8a318c9fbb433
Gerrit-Change-Number: 7960447
Gerrit-PatchSet: 1
Gerrit-Owner: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Prashant Nevase <pne...@microsoft.com>
Gerrit-CC: Prashant Nevase <pras...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Jun 2026 11:20:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Jun 22, 2026, 11:03:30 AM (11 days ago) Jun 22
to Adam Rice, Daniel Cheng, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Adam Rice and Daniel Cheng

Message from chrom...@appspot.gserviceaccount.com

📍 Job android-pixel10-perf/rendering.mobile complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/16e0d4eac90000

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not 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: If760289f525c32395638ffdfe5a8a318c9fbb433
Gerrit-Change-Number: 7960447
Gerrit-PatchSet: 1
Gerrit-Owner: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Prashant Nevase <pne...@microsoft.com>
Gerrit-CC: Prashant Nevase <pras...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Jun 2026 15:03:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniel Cheng (Gerrit)

unread,
Jun 23, 2026, 4:47:15 PM (10 days ago) Jun 23
to Adam Rice, chrom...@appspot.gserviceaccount.com, Daniel Cheng, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Adam Rice

Daniel Cheng added 2 comments

File base/containers/hashing_lru_cache.h
Line 31, Patchset 1 (Latest): // key type.
Daniel Cheng . unresolved

How many things do we need to update to teach them about AbslHashValue?

I think this is probably OK as an intermediate step, but in the final state, it seems like it'd be better to not have this shim and fallback.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not 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: If760289f525c32395638ffdfe5a8a318c9fbb433
    Gerrit-Change-Number: 7960447
    Gerrit-PatchSet: 1
    Gerrit-Owner: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Prashant Nevase <pne...@microsoft.com>
    Gerrit-CC: Prashant Nevase <pras...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Adam Rice <ri...@chromium.org>
    Gerrit-Comment-Date: Tue, 23 Jun 2026 20:46:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Adam Rice (Gerrit)

    unread,
    Jun 24, 2026, 9:15:36 PM (9 days ago) Jun 24
    to chrom...@appspot.gserviceaccount.com, Daniel Cheng, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Daniel Cheng

    Adam Rice added 2 comments

    File base/containers/hashing_lru_cache.h
    Daniel Cheng . unresolved

    How many things do we need to update to teach them about AbslHashValue?

    I think this is probably OK as an intermediate step, but in the final state, it seems like it'd be better to not have this shim and fallback.

    Adam Rice

    Because Abseil's hash can fall back to std::hash, in practice nothing needed updating. New users of HashingLRUCache are likely to see this error if their key type is not yet hashable.

    Line 17, Patchset 1 (Latest):namespace internal {
    Adam Rice

    I don't understand what you are asking for. HashingLRUCacheKeyIndex, AbslHasher and AbslEqual are all parts of the API that shouldn't be mentioned outside the implementation of HashingLRUCache, which is exactly when the style guide says to use "internal". Do you mean we should call it "internal_hashing_lru_cache" instead?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Cheng
    Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 01:15:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Cheng (Gerrit)

    unread,
    Jun 29, 2026, 5:38:37 PM (4 days ago) Jun 29
    to Adam Rice, chrom...@appspot.gserviceaccount.com, Daniel Cheng, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Adam Rice

    Daniel Cheng added 2 comments

    File base/containers/hashing_lru_cache.h
    Daniel Cheng . unresolved

    How many things do we need to update to teach them about AbslHashValue?

    I think this is probably OK as an intermediate step, but in the final state, it seems like it'd be better to not have this shim and fallback.

    Adam Rice

    Because Abseil's hash can fall back to std::hash, in practice nothing needed updating. New users of HashingLRUCache are likely to see this error if their key type is not yet hashable.

    Daniel Cheng

    I guess I'm wondering why we have this layer of indirection; why can't we just use DefaultHashContainerHash and DefaultHashContainerEq directly?

    Line 17, Patchset 1 (Latest):namespace internal {
    Daniel Cheng . unresolved

    As these bits are new, can we avoid using `base::internal` directly per the style guide guidance? https://google.github.io/styleguide/cppguide.html#Namespace_Names:~:text=Use%20namespaces%20with%20%22internal%22%20in%20the%20name%20to%20document%20parts%20of%20an%20API%20that%20should%20not%20be%20mentioned%20by%20users%20of%20the%20API.

    Adam Rice

    I don't understand what you are asking for. HashingLRUCacheKeyIndex, AbslHasher and AbslEqual are all parts of the API that shouldn't be mentioned outside the implementation of HashingLRUCache, which is exactly when the style guide says to use "internal". Do you mean we should call it "internal_hashing_lru_cache" instead?

    Daniel Cheng

    Do you mean we should call it "internal_hashing_lru_cache" instead?

    Yes (though the examples in the style give `_internal` as a suffix instead of a prefix)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Adam Rice
    Gerrit-Attention: Adam Rice <ri...@chromium.org>
    Gerrit-Comment-Date: Mon, 29 Jun 2026 21:38:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
    Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Adam Rice (Gerrit)

    unread,
    Jul 1, 2026, 2:04:18 AM (3 days ago) Jul 1
    to chrom...@appspot.gserviceaccount.com, Daniel Cheng, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Daniel Cheng

    Adam Rice added 2 comments

    File base/containers/hashing_lru_cache.h
    Line 31, Patchset 1: // key type.
    Daniel Cheng . resolved

    How many things do we need to update to teach them about AbslHashValue?

    I think this is probably OK as an intermediate step, but in the final state, it seems like it'd be better to not have this shim and fallback.

    Adam Rice

    Because Abseil's hash can fall back to std::hash, in practice nothing needed updating. New users of HashingLRUCache are likely to see this error if their key type is not yet hashable.

    Daniel Cheng

    I guess I'm wondering why we have this layer of indirection; why can't we just use DefaultHashContainerHash and DefaultHashContainerEq directly?

    Adam Rice

    It turns out we can, so I switched to that. Previously I was using a hacky method to find out what hash function Abseil would use, and it didn't always work. So I added the indirection to work around it, When I switched to the current method I didn't realise I could remove the indirection.

    Fixed.

    Line 17, Patchset 1:namespace internal {
    Daniel Cheng . resolved

    As these bits are new, can we avoid using `base::internal` directly per the style guide guidance? https://google.github.io/styleguide/cppguide.html#Namespace_Names:~:text=Use%20namespaces%20with%20%22internal%22%20in%20the%20name%20to%20document%20parts%20of%20an%20API%20that%20should%20not%20be%20mentioned%20by%20users%20of%20the%20API.

    Adam Rice

    I don't understand what you are asking for. HashingLRUCacheKeyIndex, AbslHasher and AbslEqual are all parts of the API that shouldn't be mentioned outside the implementation of HashingLRUCache, which is exactly when the style guide says to use "internal". Do you mean we should call it "internal_hashing_lru_cache" instead?

    Daniel Cheng

    Do you mean we should call it "internal_hashing_lru_cache" instead?

    Yes (though the examples in the style give `_internal` as a suffix instead of a prefix)

    Adam Rice

    Okay, used `hashing_lru_cache_internal`.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Cheng
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not 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: If760289f525c32395638ffdfe5a8a318c9fbb433
      Gerrit-Change-Number: 7960447
      Gerrit-PatchSet: 1
      Gerrit-Owner: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-CC: Prashant Nevase <pne...@microsoft.com>
      Gerrit-CC: Prashant Nevase <pras...@chromium.org>
      Gerrit-CC: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Jul 2026 06:03:54 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Daniel Cheng (Gerrit)

      unread,
      Jul 2, 2026, 6:09:33 PM (21 hours ago) Jul 2
      to Adam Rice, Daniel Cheng, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Prashant Nevase, Prashant Nevase, Stephen Chenney, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, cc-...@chromium.org, chrome-intell...@chromium.org, chrome-intelligence-te...@google.com, croissant-...@chromium.org, cros-enterpris...@chromium.org, dmurph+wa...@chromium.org, dmurph+watching...@chromium.org, drott+bl...@chromium.org, edgesto...@microsoft.com, enne...@chromium.org, feature-me...@chromium.org, filesapp...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, grt+...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, kinuko...@chromium.org, mac-r...@chromium.org, marq+...@chromium.org, mtomas...@chromium.org, net-r...@chromium.org, spang...@chromium.org, storage...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Adam Rice

      Daniel Cheng voted and added 1 comment

      Votes added by Daniel Cheng

      Code-Review+1
      Owners-Override+1

      1 comment

      Patchset-level comments
      File-level comment, Patchset 2 (Latest):
      Daniel Cheng . resolved

      LGTM

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      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: If760289f525c32395638ffdfe5a8a318c9fbb433
      Gerrit-Change-Number: 7960447
      Gerrit-PatchSet: 2
      Gerrit-Owner: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-CC: Prashant Nevase <pne...@microsoft.com>
      Gerrit-CC: Prashant Nevase <pras...@chromium.org>
      Gerrit-CC: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Thu, 02 Jul 2026 22:09:18 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages