ckerr

#47171: refactor: prefer base::circular_deque over std::deque

Merged
Created: May 20, 2025, 12:02:39 PM
Merged: May 21, 2025, 12:04:36 PM
4 comments
Target: main

Description of Change

A companion PR to #47157 to follow Chromium's usage advice.

That PR migrated std::queue use; this one migrates std::deque:

Chromium code should always use base::circular_deque or base::queue in preference to std::deque or std::queue due to memory usage and platform variation.

The base::circular_deque implementation (and the base::queue which uses it) provide performance consistent across platforms that better matches most programmer‘s expectations on performance (it doesn’t waste as much space as libc++ and doesn't do as many heap allocations as MSVC). It also generates less code than std::queue: using it across the code base saves several hundred kilobytes.

Checklist

Release Notes

Notes: none.

Backports

35-x-y
Merged
PR Number
#47191
Merged At
May 21, 2025, 3:49:38 PM
Released In
Not yet
Release Date
Not yet
36-x-y
Merged
PR Number
#47193
Merged At
May 21, 2025, 3:49:07 PM
Released In
v36.3.0
Release Date
May 22, 2025, 8:18:58 AM
37-x-y
Merged
PR Number
#47192
Merged At
May 21, 2025, 3:49:18 PM
Released In
v37.0.0-alpha.6
Release Date
May 22, 2025, 10:18:26 AM

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron