Commit Graph

3251 Commits

Author SHA1 Message Date
Ilya Tokar
5f9d5bfcc4 Optimzie crc32 on AMD Milan+
We have AVX encoded vector PCLMULQDQ on Milan, so use it to make
crc32c computations ~10% faster. We need to use inline asm, since
building this twice with different complier flags for dynamic
dispatch performed worse due to missing inlining.

BM_Calculate/0                  1.136n ±  0%    1.136n ±  1%        ~ (p=0.968 n=6)
BM_Calculate/1                  1.420n ±  0%    1.421n ±  1%        ~ (p=0.870 n=6)
BM_Calculate/100                9.089n ±  0%    9.660n ±  1%   +6.29% (p=0.002 n=6)
BM_Calculate/2048               75.30n ±  1%    67.67n ±  1%  -10.13% (p=0.002 n=6)
BM_Calculate/10000              313.1n ±  0%    286.1n ±  0%   -8.63% (p=0.002 n=6)
BM_Calculate/500000             14.91µ ±  4%    13.49µ ±  1%   -9.48% (p=0.002 n=6)
BM_Extend/0                     1.136n ±  1%    1.136n ±  1%        ~ (p=0.636 n=6)
BM_Extend/1                     1.420n ±  0%    1.420n ±  1%        ~ (p=0.636 n=6)
BM_Extend/100                   9.247n ±  2%    9.800n ±  2%   +5.99% (p=0.002 n=6)
BM_Extend/2048                  75.73n ±  1%    67.37n ±  1%  -11.04% (p=0.002 n=6)
BM_Extend/10000                 313.2n ±  1%    286.2n ±  0%   -8.62% (p=0.002 n=6)
BM_Extend/500000                14.87µ ±  1%    13.57µ ±  1%   -8.74% (p=0.002 n=6)
BM_Extend/100000000             3.185m ±  2%    2.816m ±  3%  -11.60% (p=0.002 n=6)
BM_ExtendCacheMiss/10           26.07m ±  1%    26.06m ±  1%        ~ (p=1.000 n=6)
BM_ExtendCacheMiss/100          13.86m ±  4%    14.36m ±  2%   +3.61% (p=0.026 n=6)
BM_ExtendCacheMiss/1000         27.02m ±  4%    27.28m ±  4%        ~ (p=0.699 n=6)
BM_ExtendCacheMiss/100000       5.114m ±  5%    4.600m ±  8%  -10.07% (p=0.002 n=6)
BM_ExtendByZeroes/1             1.420n ±  0%    1.420n ±  0%        ~ (p=0.670 n=12)
BM_ExtendByZeroes/10            1.704n ±  1%    1.704n ±  0%        ~ (p=1.000 n=6)
BM_ExtendByZeroes/100           3.128n ±  0%    3.128n ±  0%        ~ (p=1.000 n=6)
BM_ExtendByZeroes/1000          6.758n ±  0%    6.638n ±  1%   -1.78% (p=0.002 n=6)
BM_ExtendByZeroes/10000         6.619n ±  1%    6.503n ±  0%   -1.75% (p=0.002 n=6)
BM_ExtendByZeroes/100000        8.537n ±  1%    8.479n ±  0%   -0.67% (p=0.019 n=6)
BM_ExtendByZeroes/1000000       9.766n ±  1%    9.692n ±  1%   -0.75% (p=0.002 n=6)

PiperOrigin-RevId: 900870516
Change-Id: I1382ae2ffeed35e1d55a0916290144cae5256fe0
2026-04-16 13:02:39 -07:00
Derek Mauro
cd0423dc25 Stop exporting internal Base64 escaping functions that do not need to
be exported. The one function that is currently using it is easily
implemented with absl::Base64Escape().

PiperOrigin-RevId: 900830658
Change-Id: I859d67efafd5ba96921bb75c9207438975d055d6
2026-04-16 11:38:13 -07:00
Abseil Team
b9536c952c Add additional bounds check functions to cover most ABSL_HARDENING_ASSERTs.
Most current uses of ABSL_HARDENING_ASSERT are one of:
* numerical comparison
* checking that a container is non-empty
* checking that a pointer is non-null.

This change adds additional hardening assert functions which conduct the
comparisons necessary for these checks inside the body of the assertion
function, so that the cost of performing the check can be attributed
to the assertion.

For the smaller set of cases where more complex conditions are checked,
a general HardeningAssert which takes a bool is provided.

PiperOrigin-RevId: 899780652
Change-Id: I00602302a5d42d483053ad66d8c3e796d1708567
2026-04-14 14:42:44 -07:00
Abseil Team
04b6110da9 Undo unintended inlining of absl::void_t -- the inlining didn't actually replace it with std::void_t
PiperOrigin-RevId: 898825657
Change-Id: Icd97cec5602753759608623619acd7c6fd5bc953
2026-04-13 00:35:49 -07:00
Chris Kennelly
ea64b6e7e6 Consume result from various SampleRecorder methods.
PiperOrigin-RevId: 897903309
Change-Id: I944031c84f2bcc6c116cef750ce789381b134467
2026-04-10 14:58:39 -07:00
Abseil Team
9cb62a03a4 Remove unnecessary usages of absl::void_t
Most usages of absl::void_t compile fine with std::void_t, so we migrate them here. A few don't compile due to overly eager template instantiations, so we leave those.

PiperOrigin-RevId: 897231619
Change-Id: Iad34101916dac2b995257ebd5d6aacb9a0acfa32
2026-04-09 12:01:41 -07:00
Abhi Raman
354d4d9d13 StrFormat: format %g without heap allocation
PiperOrigin-RevId: 897196391
Change-Id: I0eeb47f4263344a7ce577d78c6029e31a7430385
2026-04-09 10:55:10 -07:00
Abseil Team
8cd64504e2 Remove unnecessary namespace bracketing for an internal nullability macro.
PiperOrigin-RevId: 897160180
Change-Id: I9e82de7c744fc71246aa6b62fd54b2ca4a1a49ac
2026-04-09 09:44:43 -07:00
Derek Mauro
9034b9ca6e Introduce ABSL_OPTION_INLINE_HW_ACCEL_STRATEGY in absl/base/options.h
to provide a centralized policy for hardware-accelerated
implementations in headers.

This option addresses ODR violations that occur when Abseil headers
use compile-time feature detection (such as __SSE4_2__) in inline
functions. If translation units are compiled with inconsistent CPU
architecture flags (e.g., -march=native vs -march=generic) and linked
together, they may disagree on the implementation of these inline
functions. This can lead to crashes or silent data corruption in
hashing.

The new option provides three levels of control:
- 0: Portable. Forces software-only implementations in headers,
  guaranteeing ABI safety across mixed translation units.
- 1: Required. Forces hardware-accelerated implementations in
  headers. The build will fail if the required instructions are not
  enabled in the compiler environment.
- 2: Auto-detect. Selects the best available implementation based on
  compiler flags, but can't guarantee safety if translation units are
  compiled with inconsistent flags.

PiperOrigin-RevId: 896569507
Change-Id: Ifcbc1f3980883feeaa4f05f845ce32310ca7d533
2026-04-08 10:20:35 -07:00
Samuel Benzaquen
884282e28f Refactor error factories to propagate static knowledge to the compiler, where supported.
This allows the compiler to optimize conversions to StatusOr since it can
assume the Status is !ok instead of having to check again.

PiperOrigin-RevId: 896110150
Change-Id: I0dc167906b761339aaac5934764fe2bd6deb1624
2026-04-07 15:16:31 -07:00
Abseil Team
eb76981586 Inline absl::void_t to std::void_t wherever possible
This won't replace all call sites, but that's fine. We only want to replace the call sites that compile fine, since they don't need to use absl::void_t.

PiperOrigin-RevId: 896017307
Change-Id: I7e78066dc973e135922b11fba5c7642563ef6a67
2026-04-07 11:55:56 -07:00
Abseil Team
e7c47687fe Deprecate and inline a lot of C++17 Abseil type traits
PiperOrigin-RevId: 895522956
Change-Id: Ie09a39d70578090a4128ab64b8c9a00f5b155a5e
2026-04-06 15:14:52 -07:00
Abseil Team
95619d531e Remove more lingering C++17 type traits polyfill usages
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 895480358
Change-Id: I2e15877c15ed83f48ddb68cc73344c14b533bc68
2026-04-06 13:44:35 -07:00
Abseil Team
709bf9ea18 nullstream: fix a header guard comment
PiperOrigin-RevId: 895415828
Change-Id: I2cb4dc6bb5e890bfc9fedf1517d45bf52c1362c1
2026-04-06 11:23:14 -07:00
Abseil Team
0b006ea16f Add SKIP_ABSL_INLINE_NAMESPACE_CHECK to absl/base/internal/exception_safety_testing.h as it doesn't use the absl namespace at all
PiperOrigin-RevId: 895410731
Change-Id: Ide13269ecfc8367d7d8ad77d0eee4f06a366c9b9
2026-04-06 11:12:40 -07:00
Mike Kruskal
7dac70835c Expose gloop peer friendship for testing
PiperOrigin-RevId: 895336821
Change-Id: I178e7d654e45de4af6bba133b496115c6d37adc1
2026-04-06 08:17:56 -07:00
Abseil Team
ed2114e8ff Stop using C++17 type traits polyfills
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
2026-04-03 12:34:35 -07:00
Derek Mauro
3eb0f0bd73 Remove the forward declaration of base::scheduling::Schedulable from
thread_identity by using a void*, and fix callers to use
base::scheduling::Schedulable::GetBoundSchedulable().

PiperOrigin-RevId: 894096577
Change-Id: I2d4c822c60501e34cadcaac7fc434ef9adb222c3
2026-04-03 08:52:00 -07:00
Abseil Team
5c01794f79 Support passing I/O manipulators such as std::endl to StringifyStream
PiperOrigin-RevId: 892740803
Change-Id: I7c0c2d330080492d1451960bc21c04e6dbcbeb22
2026-03-31 23:34:03 -07:00
Abseil Team
170f877af5 Add absl::Status::MakeNonOkStatusWithOkCode() and absl::status_internal::StatusPrivateAccessor for private/internal use
PiperOrigin-RevId: 892483178
Change-Id: Ia439eb6bc941f75250c116eaf0dfb2924ec21c29
2026-03-31 12:30:47 -07:00
Derek Mauro
4ff7ff9ee9 Add cleanup dependency
PiperOrigin-RevId: 891759296
Change-Id: I315b927a89cbb7e8d25c77e994d07b0e545f6909
2026-03-30 09:32:24 -07:00
Derek Mauro
d2910b037f Prepare to move callers away from get_bound_schedulable()
to remove the forward declaration of base::scheduling::Schedulable.

PiperOrigin-RevId: 890987711
Change-Id: I42695f6f9b7e60627e65b00e9269cf53f497f988
2026-03-28 10:55:58 -07:00
Abseil Team
0093ac6cac Prevent users of absl::AnySpan::subspan(pos, len) from relying on truncation behavior while the migration from this nonstandard function is in progress.
PiperOrigin-RevId: 889935946
Change-Id: I0b3e95ba579f66f1e1982ddb768844f7554c932c
2026-03-26 10:57:52 -07:00
Abseil Team
e2321c00f9 Add support for [[clang::annotate("clang-tidy", "bugprone-use-after-move", "null_after_move")]]
annotations.

This will be used to prevent false positives in the clang-tidy check
bugprone-use-after-move.

PiperOrigin-RevId: 889929118
Change-Id: I19ae27ef20abce9982fbfdcaad4a0aa0fa57f1bd
2026-03-26 10:45:50 -07:00
Laramie Leavitt
b7c61d35e6 Reduce duplication in absl/random/internal.
Consolidate the mocking requirements so that mock detection is mediated
via the MockingAccess class
* HasInvokeMock has been deduplicated; MockingAccess now owns it
* InvokeMock is done via MockingAccess::InvokeMock
* In absl::BitGenRef, if a class has a conversion operator that is used.
* `friend class MockingAccess` is now the only mocking friend, except for backwards compat.
  - friend DistributionCaller is now unnecessary.
  - friend BitGenRef is now unnecessary.
  - friend MockHelpers now unnecessary.

PiperOrigin-RevId: 889366369
Change-Id: I288cd60f6ac13b257c10ec3268d96828f1e61db6
2026-03-25 12:08:24 -07:00
Taylor Cramer
cc986e47a7 Use absl::SourceLocation for Rust source locations in Status
This is intentionally not exposing absl::SourceLocation to Rust yet, since the ownership questions (absl::Status vs. interning etc.) have not yet been decided.

PiperOrigin-RevId: 889297573
Change-Id: I14ed9c1b03c4229bc59e746b49685e87778e6b46
2026-03-25 09:53:05 -07:00
Abseil Team
be50e52a07 Avoid using lambdas in Abseil assertion macros
Lambdas are costlier at compile-time and run-time, as they are much heavier machinery and lean much more heavily on the optimizer.

PiperOrigin-RevId: 888814590
Change-Id: I439a36eb6e5ad28fd16675bc254beb315172544c
2026-03-24 13:02:57 -07:00
Derek Mauro
b71166ddd7 Minor changes to #includes
PiperOrigin-RevId: 888224533
Change-Id: I88e7a074c16e98e6cadb861c76b8bda4fd876a1b
2026-03-23 12:30:01 -07:00
Chris Mihelich
4c5d34c1e5 Document that DemangleRustSymbolEncoding omits some details on purpose.
PiperOrigin-RevId: 888093923
Change-Id: If923d44a1c5c6f6668314499dedf7c52f08b9341
2026-03-23 07:55:14 -07:00
Martijn Vels
9cc7e8dbd5 Add gloop/perftools/tracing visibility
PiperOrigin-RevId: 886939127
Change-Id: I07bd7172b38c1bf2528713a314fb869280211800
2026-03-20 13:10:08 -07:00
Mike Kruskal
6c1f120e3e Add //gloop/util/status:status_macros to Gloop
PiperOrigin-RevId: 885969057
Change-Id: I11d30ca91b576e61664efc68dd4c1df353eec6be
2026-03-18 22:32:30 -07:00
Abseil Team
88c0a25fde Remove the legacy stateless symbol decorator API.
PiperOrigin-RevId: 884958234
Change-Id: I288a4b143718a155663669b7d2e4a24a89d754ec
2026-03-17 05:11:13 -07:00
Derek Mauro
e8f3bb209b Add additional tests in str_split_test.cc
PiperOrigin-RevId: 884611329
Change-Id: I5944333d11c85867652fc5e596020381c445d562
2026-03-16 13:34:12 -07:00
Abseil Team
0a7fe7e8da Add absl::strings_internal::AbslStringifyStream
PiperOrigin-RevId: 883300728
Change-Id: Ib5c83114fdc4e292ad8fcf96a899878315707353
2026-03-13 13:01:43 -07:00
Abseil Team
81f4d83f38 Add supporting code for absl::SourceLocation
PiperOrigin-RevId: 883256961
Change-Id: I536f9dc76ce4f248b5c87eaf27515cd8a4a484ca
2026-03-13 11:25:47 -07:00
Abseil Team
522a5a8b51 Open-source absl::AnySpan
PiperOrigin-RevId: 883174961
Change-Id: Iea8fe182d759350f2b84e78892243867cd9f4be8
2026-03-13 08:20:14 -07:00
Mike Kruskal
efcd129252 Add //gloop/util/gtl:iterator_range to Gloop
PiperOrigin-RevId: 882759769
Change-Id: Ibcd549a6416bbdfa6ee37f880c760f681916a77c
2026-03-12 13:48:00 -07:00
Mike Kruskal
1bcce1bda4 Internal functionality
PiperOrigin-RevId: 882667993
Change-Id: I47f0d92b58caa9cc137ae92e8b568277dd9b1d78
2026-03-12 10:37:49 -07:00
Vitaly Goldshteyn
ec35402ac9 Fix sampling for the insert into a non-SOO table with capacity==1.
RecordInsertMiss is where we increment size for hashtablez.
This call was missing, so size was off by one.
We can even end up with negative size if a later erase takes place on the same table.

PiperOrigin-RevId: 882493632
Change-Id: Ifbb58fb2eaa0225d310c919bd0162dc2e0185d58
2026-03-12 03:39:10 -07:00
Vitaly Goldshteyn
896d915069 Add benchmark for string erase/emplace.
PiperOrigin-RevId: 882449051
Change-Id: Ie32afa3aa75f4b82ddc9dc9a9909497aaa4dd052
2026-03-12 01:42:21 -07:00
Derek Mauro
972e4ab4a0 Minor reformatting
PiperOrigin-RevId: 882117140
Change-Id: Ibe88c2385114a286eaa93d4047b11e3be55a03d4
2026-03-11 11:38:12 -07:00
Samuel Benzaquen
93a7a9cfe1 Prepare GenericPrinter for the rename of ArenaSafeUniquePtr.
PiperOrigin-RevId: 882021829
Change-Id: Idf65e88bd3ba1f285195dd60a9d8fc82bb61e516
2026-03-11 08:15:53 -07:00
Todd Lipcon
04f3bc01d1 Fix hashtablez oversampling for SOO tables on repeated 0->1 element transitions
Currently, when an absl::flat_hash_set or flat_hash_map with SOO (Single Object Optimization) transitions from 0 to 1 element, it queries should_sample_soo() to determine if it should be sampled by hashtablez. If it is NOT sampled, it remains an SOO table. If that element is subsequently erased, the table goes back to 0 elements. The next time it goes from 0 to 1, it queries should_sample_soo() again.

Repeated insert/erase cycles on an SOO table effectively evaluate the sampling logic hundreds of times, making it extremely likely that the table eventually gets sampled and moved to the heap. This causes hashtablez to vastly overstate the memory usage of such maps in production.

This CL fixes this by tracking whether an SOO table has already been evaluated for sampling, so it only evaluates the logic once per table object instance. Since SOO tables do not hash keys, they do not need the per-table generic seed value. This CL utilizes the lowest bit of the unused seed field within HashtableSize (accessed via data_ & 1) to act as a flag soo_has_tried_sampling.

When an SOO table transitions from 0 elements to 1 element, this bit is checked. If it is false, should_sample_soo() is queried and the bit is set to true. set_full_soo() and set_empty_soo() have been modified to preserve the soo_has_tried_sampling bit across erase or clear operations.

PiperOrigin-RevId: 881570273
Change-Id: Ia3b0eff8b3e137b0d162a207220a184923e3a2ca
2026-03-10 12:33:52 -07:00
Abseil Team
e7ba8a7852 Add absl::SourceLocation
PiperOrigin-RevId: 881550268
Change-Id: I1add4438cecc44f41f01c0570c69bb85f706ecfc
2026-03-10 11:52:33 -07:00
Abseil Team
842679cdbb Add a stateful version of the SymbolDecorator interface
This makes it possible to make decoration faster by caching some information between runs. Instead of a simple callback a decorator can be a class with a virtual function. This function will not be called concurrently, so it does not need to worry about locking, but it may be called from a signal handler so it must avoid any signal-unsafe operations. The decorator is registered via a factory function, which creates a new object.

Internally, the new decorators are stored inside the ObjFile object and initialized on the first use. If a different factory function is registered, the old decorators are destroyed on the next call to absl::Symbolize.

In order to make the state management simpler, we only support registering a single decorator.

The old interface is left in place to make the migration easier, but it will be removed soon.

PiperOrigin-RevId: 881284709
Change-Id: I25b9db656531fabebd1004f7ec298dc31613b8e3
2026-03-10 01:39:14 -07:00
Abseil Team
e72b94a2f2 Make absl_testing::StatusIs() print the status code as a string
PiperOrigin-RevId: 879816561
Change-Id: If257ed800753dc049dfb73e1948ba35ee7846b5d
2026-03-06 14:19:14 -08:00
Derek Mauro
6015232266 Mark absl::FastTypeId final to prevent subclassing
PiperOrigin-RevId: 879085283
Change-Id: I8a094c45cebb83839f423ef80b0e25decc3b1ef5
2026-03-05 08:34:09 -08:00
Abseil Team
267879b45a Import of CCTZ from GitHub.
PiperOrigin-RevId: 878737376
Change-Id: I17e588709cf5753959c237f540d3261cb3ed09eb
2026-03-04 17:09:39 -08:00
Abseil Team
3b777f6798 Import of CCTZ from GitHub.
PiperOrigin-RevId: 878100307
Change-Id: I644ac3192ef3a888591b93986c53b370fcd76a28
2026-03-03 13:29:09 -08:00
Derek Mauro
1d3714755a Fix ambiguous call to EncodeVarint()
Fixes #2021

PiperOrigin-RevId: 877567617
Change-Id: I99f8f6f121e1dcea2b45d679bdda86b89cf14582
2026-03-02 14:05:26 -08:00