Roll libc++ from 97b436da4c33 to 9ba7713d3a0f (88 revisions)

https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git/+log/97b436da4c33..9ba7713d3a0f

- This change also modifies base/threading/platform_thread_apple.mm.
It extracts the default `constexpr` constants and marks some
globals as `constinit`. This is now necessary due to #76180 causing
`std::atomic<TimeConstraints>` to emit a static initializer on
mac-rel.

2026-07-31 ldionne.2@gmail.com [libc++] Add an assertion for monotonic_buffer_resource's initial_size (#213136)
2026-07-31 ldionne.2@gmail.com [libc++] Fix dangling reference in the associative container benchmarks (#213139)
2026-07-31 ldionne.2@gmail.com [libc++] Actually partially populate the container in a benchmark (#213146)
2026-07-31 mike.kazakov@gmail.com [libc++][NFC] Make size_t -> int conversions explicit in a few PSTL tests (#213145)
2026-07-31 nikolasklauser@berlin.de [libc++abi] Add a clang-tidy config and test (#207324)
2026-07-31 nikolasklauser@berlin.de [libc++] Simplify clear_padding.h a bit (#212426)
2026-07-31 nikolasklauser@berlin.de [libc++] Make __has_array_cookie a variable template (#212767)
2026-07-31 mike.kazakov@gmail.com [libc++][pstl] Implementation of parallel std::lexicographical_compare() based on std::mismatch() (#212366)
2026-07-30 zibi@ca.ibm.com [libc++] Fix difference_type expectations in range adaptor iterator member_types tests (#201853)
2026-07-30 kevinwkt@google.com [libc++] Fix std::mt19937 seeding with std::seed_seq under vectorized ABI (#209860)
2026-07-30 hghristov.rmm@gmail.com [libc++][ranges] P3059R2: Making user-defined constructors of view iterators/sentinels private (#193891)
2026-07-30 nikolasklauser@berlin.de [libc++] Fix exception_fallback.ipp not compiling (#212961)
2026-07-30 nikolasklauser@berlin.de [libc++] Switch XFAIL in xsgetn.buffer.pass.cpp to LLVM 23 (#212969)
2026-07-30 nikolasklauser@berlin.de [libc++abi] Use the same .clang-format as libc++ (#208661)
2026-07-30 nikolasklauser@berlin.de [libc++] Clean up windows macros (#207577)
2026-07-30 ldionne.2@gmail.com [libc++] Fix incorrect paper statuses (#212827)
2026-07-30 nikolasklauser@berlin.de [libc++][NFC] Rename the streambuf members (#212277)
2026-07-30 nikolasklauser@berlin.de [libc++] Move numpunct into <__locale_dir/num.h> (#212465)
2026-07-30 nikolasklauser@berlin.de [libc++] Remove SFINAE checks in tuple which are always true (#212765)
2026-07-29 wtranviet@proton.me [libc++] Granularize `<optional>` (#206644)
2026-07-29 higher.performance.github@gmail.com Speed up compilation of typical invocations of std::visit(std::variant<...>) for up to 11 types (#164196)
2026-07-29 github.snugness349@passinbox.com [libc++][math] Add missing `constexpr since C++23` comment for `signbit` (#212458)
2026-07-29 mike.kazakov@gmail.com [libc++][pstl] Implementation of a parallel std::adjacent_find() based on std::mismatch() (#210604)
2026-07-29 nikolasklauser@berlin.de [libc++][NFC] Clean up atomic_support.h (#212464)
2026-07-29 hui.xie1990@gmail.com [libc++][test][NFC] remove old UNSUPPORTED clang from clear_padding.pass.cpp (#212690)
2026-07-29 vyordangiovani@gmail.com [libc++] Mark LWG3133 as Complete and add valarray operator[] safety tests (#208145)
2026-07-28 ldionne.2@gmail.com [libc++] Reduce sequence container benchmark size ladder (#212281)
2026-07-28 ldionne.2@gmail.com [libc++] Drop char8_t instantiation from string benchmarks (#212283)
2026-07-28 ldionne.2@gmail.com [libc++] Defer removal of two escape hatches to LLVM 25 (#211553)
2026-07-28 github.snugness349@passinbox.com [libc++][math] Add `constexpr` to comparison functions (#210075)
2026-07-28 hghristov.rmm@gmail.com [libc++][optional][NFC] Use variable templates instead of class templates (#212443)
2026-07-28 nikolasklauser@berlin.de [libc++] Fix ungetc failing after xsgetn (#210951)
2026-07-28 de34@live.cn [libc++][test] Suppress warning on bitwise shift with `bool` operands in `std::byte` tests for MSVC (#212433)
2026-07-28 de34@live.cn [libc++][test][NFC] Format `test_macros.h` (#212442)
2026-07-28 de34@live.cn [libc++][test] Disable test coverage for `_BitInt` for non-libc++ implementations (#212435)
2026-07-28 nikolasklauser@berlin.de [libc++] Simplify some meta-programming in tuple (#212436)
2026-07-28 hui.xie1990@gmail.com [libc++] Implement P0528R3 `std::atomic` CAS for types with padding (#76180)
2026-07-27 ldionne.2@gmail.com [libc++] Rename the test suite used on LNT (#212347)
2026-07-27 hui.xie1990@gmail.com [libc++][test] re-enable clear padding runtime test (#211258)
2026-07-27 ldionne.2@gmail.com [libc++] Add benchmark for std::nth_element (#210112)
2026-07-27 ldionne.2@gmail.com [libc++] Add benchmarks for std::min_element, std::max_element and std::ranges::max (#209590)
2026-07-27 ldionne.2@gmail.com [libc++] Add benchmarks for std::next_permutation and std::prev_permutation (#210966)
2026-07-27 nikolasklauser@berlin.de [libc++][NFC] Use [[deprecated]] for __grow_by (#209126)
2026-07-27 wtranviet@proton.me [libc++] Inline `text_encoding` alias offset table std::count to 884 (#207471)
2026-07-27 nikolasklauser@berlin.de [libc++] Remove locale::id::__next_id from the ABI (#210360)
2026-07-27 aviipatel06@gmail.com [libc++] Implement P1901R2: owner_hash and owner_equal for shared_ptr/weak_ptr (#210551)
2026-07-26 thakis@chromium.org [libc++] Removing traiilng whitespace at line end in CMakeLists.txt (#212135)
2026-07-27 emmettzhang2020@outlook.com [libc++][chrono] Implement LWG 4274: Allow chrono::hh_mm_ss to be constructed from unsigned durations (#209686)
2026-07-26 nikolasklauser@berlin.de [libc++][NFC] Inline fstream functions into the class body (#211738)
2026-07-26 mike.kazakov@gmail.com [libc++][pstl] Implementation of a parallel std::mismatch() based on __pstl::__parallel_find() (#209291)
2026-07-26 github.snugness349@passinbox.com [libc++][math] Add `constexpr` to `std::fpclassify` (#210993)
2026-07-25 hui.xie1990@gmail.com [libc++] Implement  `std::function_ref` (#186692)
2026-07-24 ldionne.2@gmail.com [libc++] Rename pre-commit CI workflows (#211844)
2026-07-24 ldionne.2@gmail.com [libc++][CI] Add a Github workflow to test libc++ tools (#211067)
2026-07-23 ldionne.2@gmail.com [libc++] Pin down the compiler in the various benchmark scripts and jobs (#211563)
2026-07-23 ldionne.2@gmail.com [libc++] Implement any_of in terms of find_if (#207274)
2026-07-23 ldionne.2@gmail.com [libc++] Remove workaround for Clang < 20 in clang-tidy plugin (#211314)
2026-07-23 ldionne.2@gmail.com [libc++] Update release procedure for libc++ & friends (#210383)
2026-07-23 nikolasklauser@berlin.de [libc++] Remove some adjacent_view::begin() benchmarks (#210265)
2026-07-23 nikolasklauser@berlin.de [libc++] Optimize standard streams with sync_with_stdio(false) (#209161)
2026-07-22 hghristov.rmm@gmail.com [libc++][NFC] Format and move `transform_view`'s `sentinel.pass.cpp` (#211252)
2026-07-22 ldionne.2@gmail.com [runtimes] LLVM 24 version bumps (#211262)
2026-07-22 nikolasklauser@berlin.de [libc++] Don't add #pragma clang attribute with GCC (#206989)
2026-07-22 nikolasklauser@berlin.de [libc++] Remove redundant benchmarks for lexicographical_compare_three_way (#210268)
2026-07-22 vvereschaka@accesssoftek.com Revert "[libc++][test] XFAIL `text/text_encoding/environment.pass.cpp` test on Armv7/Linux Ubuntu targets." (#211112)
2026-07-22 nikolasklauser@berlin.de [libc++] Remove {Pause,Resume}Timing from fast push_back benchmarks (#209130)
2026-07-21 dkovalev@accesssoftek.com [PAC][libc++] Fix build with `ptrauth_calls` feature (#211033)
2026-07-21 github.snugness349@passinbox.com [libc++][ranges] Mark LWG3664 as resolved (#210550)
2026-07-21 ldionne.2@gmail.com [libc++] Don't require complete types in vector<T>::empty() (#210754)
2026-07-21 ldionne.2@gmail.com [libc++] Fix test-at-commit after df4bb1f3106d (#210983)
2026-07-21 mike.kazakov@gmail.com [libc++][pstl] Default implementation of parallel std::adjacent_difference (#207585)
2026-07-21 c8ef@outlook.com [libc++] Implement P0493R5: Atomic minimum/maximum (#180333)
2026-07-21 mike.kazakov@gmail.com [libc++] Strip cv-refs in __desugars_to specialization for integral types (#208950)
2026-07-21 h.vetinari@gmx.com [libc++][NFC] Re-order availability mapping to `_LIBCPP_INTRODUCED_IN_LLVM_{N}` (#210694)
2026-07-21 ldionne.2@gmail.com [libc++] Compose the test suite Lit site config from harness and installation substitutions (#209638)
2026-07-21 ldionne.2@gmail.com [libc++][NFC] Fix synopsis comment for error_condition::message() (#210724)
2026-07-21 ldionne.2@gmail.com [libc++] Include sizes in string benchmark names (#210795)
2026-07-20 hghristov.rmm@gmail.com [libc++][ranges][NFC] Format a couple of `elements_view` tests (#210687)
2026-07-21 de34@live.cn [libc++][docs] Avoid talking about other implementations on DR status (#210637)
2026-07-20 ldionne.2@gmail.com [libc++] Bring std::{any,all,none}_of tests up to current standards (#209266)
2026-07-20 hubert.reinterpretcast@gmail.com [libc++][utils] Fix LIT `%if` substitution support (#209358)
2026-07-20 thurston@google.com [libc++][test] Fix build failure from typo in #171785 (#210552)
2026-07-20 hghristov.rmm@gmail.com [libc++][test][NFC] Removed unsupported compilers from tests (#210413)
2026-07-20 hghristov.rmm@gmail.com [libc++][NFC] Removed duplicated `_LIBCPP_INTRODUCED_IN_LLVM_23` macros (#210602)
2026-07-20 hghristov.rmm@gmail.com [libc++][ranges][NFC] Format `lazy_split_view` (#210644)
2026-07-20 nikolasklauser@berlin.de Reapply "[libc++][NFC] Inline std::function members into the class body" (#209555) (#210260)
2026-07-20 de34@live.cn [libc++] Add tests for LWG3798 and mark it as Complete (#210640)
2026-07-20 hghristov.rmm@gmail.com [libc++][cmp][NFC] Fix: Empty namespaces should be avoided (#210624)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/libcxx-chromium
Please CC hans@chromium.org,thakis@chromium.org on the revert to ensure that a human
is aware of the problem.

To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Change-Id: I7b77dfc70c8f7018987e08ba18d8d5f6ed402526
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8581765
Commit-Queue: Liza Burakova <liza@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1725118}
NOKEYCHECK=True
GitOrigin-RevId: fb80ea1e4cdf5a1c2133ae9afb1c7db445612854
1 file changed
tree: 05a61f95d2a83ca1233a604d69af4e47aec5ec3d
  1. allocator/
  2. android/
  3. apple/
  4. containers/
  5. debug/
  6. files/
  7. fuchsia/
  8. functional/
  9. hash/
  10. i18n/
  11. ios/
  12. json/
  13. logging/
  14. mac/
  15. macros/
  16. memory/
  17. memory_coordinator/
  18. message_loop/
  19. metrics/
  20. nix/
  21. numerics/
  22. posix/
  23. power_monitor/
  24. process/
  25. profiler/
  26. sampling_heap_profiler/
  27. strings/
  28. substring_set_matcher/
  29. synchronization/
  30. system/
  31. task/
  32. test/
  33. third_party/
  34. threading/
  35. time/
  36. timer/
  37. tools/
  38. trace_event/
  39. tracing/
  40. types/
  41. version_info/
  42. win/
  43. at_exit.cc
  44. at_exit.h
  45. at_exit_unittest.cc
  46. atomic_ref_count.h
  47. atomic_sequence_num.h
  48. atomicops.cc
  49. atomicops.h
  50. atomicops_internals_portable.h
  51. atomicops_unittest.cc
  52. auto_reset.h
  53. auto_reset_unittest.cc
  54. barrier_callback.h
  55. barrier_callback_unittest.cc
  56. barrier_closure.cc
  57. barrier_closure.h
  58. barrier_closure_unittest.cc
  59. base64.cc
  60. base64.h
  61. base64_decode_fuzzer.cc
  62. base64_encode_fuzzer.cc
  63. base64_unittest.cc
  64. base64url.cc
  65. base64url.h
  66. base64url_unittest.cc
  67. base_export.h
  68. base_paths.cc
  69. base_paths.h
  70. base_paths_android.cc
  71. base_paths_android.h
  72. base_paths_apple.cc
  73. base_paths_apple.h
  74. base_paths_fuchsia.cc
  75. base_paths_ios.h
  76. base_paths_ios.mm
  77. base_paths_mac.h
  78. base_paths_mac.mm
  79. base_paths_posix.cc
  80. base_paths_posix.h
  81. base_paths_win.cc
  82. base_paths_win.h
  83. base_rust_unittests.rs
  84. base_switches.h
  85. bit_cast.h
  86. bit_cast_unittest.cc
  87. bits.h
  88. bits_unittest.cc
  89. BUILD.gn
  90. build_time.h
  91. build_time_unittest.cc
  92. byte_conversions_perftest.cc
  93. byte_size.cc
  94. byte_size.h
  95. byte_size_nocompile.nc
  96. byte_size_unittest.cc
  97. callback_list.cc
  98. callback_list.h
  99. callback_list_nocompile.nc
  100. callback_list_unittest.cc
  101. cancelable_callback.h
  102. cancelable_callback_unittest.cc
  103. check.cc
  104. check.h
  105. check_deref.h
  106. check_deref_nocompile.nc
  107. check_deref_unittest.cc
  108. check_example.cc
  109. check_is_test.cc
  110. check_is_test.h
  111. check_is_test_unittest.cc
  112. check_nocompile.nc
  113. check_op.cc
  114. check_op.h
  115. check_unittest.cc
  116. check_version_internal.h.in
  117. command_line.cc
  118. command_line.h
  119. command_line.rs
  120. command_line_fuzzer.cc
  121. command_line_rust_shim.cc
  122. command_line_rust_shim.h
  123. command_line_unittest.cc
  124. command_line_unittest.rs
  125. compiler_hardening_test.cc
  126. compiler_specific.h
  127. component_export.h
  128. component_export_unittest.cc
  129. cpu.cc
  130. cpu.h
  131. cpu_unittest.cc
  132. critical_closure.h
  133. critical_closure_internal_ios.mm
  134. dcheck_is_on.h
  135. DEPS
  136. DIR_METADATA
  137. enterprise_util.cc
  138. enterprise_util.h
  139. enterprise_util_mac.mm
  140. enterprise_util_mac_unittest.mm
  141. enterprise_util_win.cc
  142. environment.cc
  143. environment.h
  144. environment_unittest.cc
  145. export_template.h
  146. feature.h
  147. feature.rs
  148. feature_internal.h
  149. feature_list.cc
  150. feature_list.h
  151. feature_list_internal.cc
  152. feature_list_internal.h
  153. feature_list_unittest.cc
  154. feature_nocompile.nc
  155. feature_rust_shim.cc
  156. feature_rust_shim.h
  157. feature_unittest.rs
  158. feature_visitor.h
  159. features.cc
  160. features.h
  161. file_descriptor_posix.cc
  162. file_descriptor_posix.h
  163. file_descriptor_store.cc
  164. file_descriptor_store.h
  165. file_version_info.h
  166. file_version_info_apple.h
  167. file_version_info_apple.mm
  168. file_version_info_win.cc
  169. file_version_info_win.h
  170. file_version_info_win_unittest.cc
  171. format_macros.h
  172. gmock_unittest.cc
  173. gtest_prod_util.h
  174. immediate_crash.h
  175. immediate_crash_unittest.cc
  176. lazy_instance.h
  177. lazy_instance_helpers.cc
  178. lazy_instance_helpers.h
  179. lazy_instance_unittest.cc
  180. libcpp_hardening_test.cc
  181. linux_util.cc
  182. linux_util.h
  183. linux_util_unittest.cc
  184. location.cc
  185. location.h
  186. location_unittest.cc
  187. logging.cc
  188. logging.h
  189. logging_chromeos.cc
  190. logging_nocompile.nc
  191. logging_unittest.cc
  192. logging_win.cc
  193. logging_win.h
  194. moving_window.h
  195. moving_window_unittest.cc
  196. native_library.h
  197. native_library_apple.mm
  198. native_library_fuchsia.cc
  199. native_library_posix.cc
  200. native_library_unittest.cc
  201. native_library_win.cc
  202. no_destructor.h
  203. no_destructor_nocompile.nc
  204. no_destructor_unittest.cc
  205. not_fatal_until.h
  206. notimplemented.h
  207. notreached.h
  208. observer_list.h
  209. observer_list_internal.cc
  210. observer_list_internal.h
  211. observer_list_nocompile.nc
  212. observer_list_perftest.cc
  213. observer_list_threadsafe.cc
  214. observer_list_threadsafe.h
  215. observer_list_threadsafe_unittest.cc
  216. observer_list_types.cc
  217. observer_list_types.h
  218. observer_list_unittest.cc
  219. one_shot_event.cc
  220. one_shot_event.h
  221. one_shot_event_unittest.cc
  222. os_compat_android.cc
  223. os_compat_android.h
  224. OWNERS
  225. parameter_pack.h
  226. parameter_pack_unittest.cc
  227. path_service.cc
  228. path_service.h
  229. path_service_unittest.cc
  230. pending_task.cc
  231. pending_task.h
  232. pickle.cc
  233. pickle.h
  234. pickle_fuzzer.cc
  235. pickle_unittest.cc
  236. PRESUBMIT.py
  237. protobuf_hardening_test.cc
  238. protobuf_hardening_test_support.proto
  239. rand_util.cc
  240. rand_util.h
  241. rand_util_fuchsia.cc
  242. rand_util_perftest.cc
  243. rand_util_posix.cc
  244. rand_util_unittest.cc
  245. rand_util_win.cc
  246. README.md
  247. run_loop.cc
  248. run_loop.h
  249. run_loop.rs
  250. run_loop_nocompile.nc
  251. run_loop_rust_shim.cc
  252. run_loop_rust_shim.h
  253. run_loop_unittest.cc
  254. safe_numerics_nocompile.nc
  255. safe_numerics_unittest.cc
  256. scoped_add_feature_flags.cc
  257. scoped_add_feature_flags.h
  258. scoped_add_feature_flags_unittest.cc
  259. scoped_clear_last_error.h
  260. scoped_clear_last_error_unittest.cc
  261. scoped_clear_last_error_win.cc
  262. scoped_environment_variable_override.cc
  263. scoped_environment_variable_override.h
  264. scoped_generic.h
  265. scoped_generic_unittest.cc
  266. scoped_multi_source_observation.h
  267. scoped_multi_source_observation_unittest.cc
  268. scoped_native_library.cc
  269. scoped_native_library.h
  270. scoped_native_library_unittest.cc
  271. scoped_observation.h
  272. scoped_observation_traits.h
  273. scoped_observation_unittest.cc
  274. SECURITY_OWNERS
  275. security_unittest.cc
  276. sequence_checker.cc
  277. sequence_checker.h
  278. sequence_checker_impl.cc
  279. sequence_checker_impl.h
  280. sequence_checker_nocompile.nc
  281. sequence_checker_unittest.cc
  282. sequence_token.cc
  283. sequence_token.h
  284. sequence_token_unittest.cc
  285. simdutf_shim.cc
  286. simdutf_shim.h
  287. stack_canary_linux.cc
  288. stack_canary_linux.h
  289. stack_canary_linux_unittest.cc
  290. state_transitions.h
  291. state_transitions_unittest.cc
  292. std_clamp_unittest.cc
  293. stl_util.h
  294. stl_util_unittest.cc
  295. supports_user_data.cc
  296. supports_user_data.h
  297. supports_user_data_unittest.cc
  298. sync_socket.cc
  299. sync_socket.h
  300. sync_socket_posix.cc
  301. sync_socket_unittest.cc
  302. sync_socket_win.cc
  303. sys_byteorder.h
  304. sys_byteorder_unittest.cc
  305. syslog_logging.cc
  306. syslog_logging.h
  307. thread_annotations.h
  308. thread_annotations_nocompile.nc
  309. thread_annotations_unittest.cc
  310. token.cc
  311. token.h
  312. token_unittest.cc
  313. tools_sanity_unittest.cc
  314. traits_bag.h
  315. traits_bag_nocompile.nc
  316. traits_bag_unittest.cc
  317. tuple.h
  318. tuple_unittest.cc
  319. unguessable_token.cc
  320. unguessable_token.h
  321. unguessable_token.rs
  322. unguessable_token_unittest.cc
  323. unsafe_buffers_nocompile.nc
  324. unsafe_buffers_unittest.cc
  325. uuid.cc
  326. uuid.h
  327. uuid_unittest.cc
  328. value_iterators.cc
  329. value_iterators.h
  330. value_iterators_unittest.cc
  331. values.cc
  332. values.h
  333. values_nocompile.nc
  334. values_unittest.cc
  335. version.cc
  336. version.h
  337. version_unittest.cc
  338. vlog.cc
  339. vlog.h
  340. vlog_unittest.cc
  341. write_build_date_header.py
README.md

What is this

Contains a written down set of principles and other information on //base. Please add to it!

About //base:

Chromium is a very mature project. Most things that are generally useful are already here and things not here aren't generally useful.

The bar for adding stuff to base is that it must have demonstrated wide applicability. Prefer to add things closer to where they're used (i.e. “not base”), and pull into base only when needed. In a project our size, sometimes even duplication is OK and inevitable.

Adding a new logging macro DPVELOG_NE is not more clear than just writing the stuff you want to log in a regular logging statement, even if it makes your calling code longer. Just add it to your own code.

If the code in question does not need to be used inside base, but will have multiple consumers across the codebase, consider placing it in a new directory under components/ instead.

base is written for the Chromium project and is not intended to be used outside it. Using base outside of src.git is explicitly not supported, and base makes no guarantees about API (or even ABI) stability (like all other code in Chromium). New code that depends on base/ must be in src.git. Code that's not in src.git but pulled in through DEPS (for example, v8) cannot use base.

Qualifications for being in //base OWNERS

  • interest and ability to learn low level/high detail/complex c++ stuff
  • inclination to always ask why and understand everything (including external interactions like win32) rather than just hoping the author did it right
  • mentorship/experience
  • demonstrated good judgement (esp with regards to public APIs) over a length of time

Owners are added when a contributor has shown the above qualifications and when they express interest. There isn't an upper bound on the number of OWNERS.

Design and naming

  • Be sure to use the base namespace.
  • STL-like constructs should adhere as closely to STL as possible. Functions and behaviors not present in STL should only be added when they are related to the specific data structure implemented by the container.
  • For STL-like constructs our policy is that they should use STL-like naming even when it may conflict with the style guide. So functions and class names should be lower case with underscores. Non-STL-like classes and functions should use Google naming.

Performance testing

Since the primitives provided by //base are used very widely, it is important to ensure they scale to the necessary workloads and perform well under all supported platforms. The base_perftests target is a suite of synthetic microbenchmarks that measure performance in various scenarios:

  • BasicPostTaskPerfTest: Exercises MessageLoopTaskRunner's multi-threaded queue in isolation.
  • ConditionVariablePerfTest: Measures thread switching cost of condition variables.
  • IntegratedPostTaskPerfTest: Exercises the full MessageLoop/RunLoop machinery.
  • JSONPerfTest: Tests JSONWriter and JSONReader performance.
  • MessageLoopPerfTest: Measures the speed of task posting in various configurations.
  • ObserverListPerfTest: Exercises adding, removing and signalling observers.
  • PartitionLockPerfTest: Tests the implementation of Lock used in PartitionAlloc
  • PthreadEventPerfTest: Establishes the baseline thread switching cost using pthreads.
  • RandUtilPerfTest: Measures the time it takes to generate random numbers.
  • ScheduleWorkTest: Measures the overhead of MessagePump::ScheduleWork.
  • SequenceManagerPerfTest: Benchmarks SequenceManager scheduling with various underlying task runners.
  • TaskObserverPerfTest: Measures the incremental cost of adding task observers.
  • TaskPerfTest: Checks the cost of posting tasks between threads.
  • ThreadLocalStoragePerfTest: Exercises different mechanisms for accessing data associated with the current thread (C++ thread_local, the implementation in //base, the POSIX/WinAPI directly)
  • WaitableEvent{Thread,}PerfTest: Measures waitable events in single and multithreaded scenarios.

Regressions in these benchmarks can generally by caused by 1) operating system changes, 2) compiler version or flag changes or 3) changes in //base code itself.

Rust code

Rust code in base should be organized into very small crates, split up by function. Merging crates is sometimes unavoidable (due to dependency cycles or the orphaning rule).

Rust files should live near the equivalent C++ files (if any), and use the same naming scheme (for example, run_loop.rs, not run_loop_rust.rs).

When adding FFI shims, prefer separate _shim.h files rather than adding code to existing C++ files. This helps avoid circular dependencies with the //base target. It also avoids adding code to commonly-used headers, which can increase compile size by a lot.

Crates which you expect to be widely used should be added to the public_deps of the //base:base_rust target, so that developers can simply depend on //base:base_rust the same way they do with //base.