By comparing to the total number of objects, we can better determine the hit/miss ratio of various call sites and suitable container reservation sizes based on typical inputs.
PiperOrigin-RevId: 871381187
Change-Id: I88e92f028622177d1f343be3e65bcb7a3e41d234
that use an output parameter.
These versions are clearly inferior to the versions that return
a string.
This is a response to https://github.com/abseil/abseil-cpp/issues/2015Fixes#2015
PiperOrigin-RevId: 870281461
Change-Id: I92f23d51d05a243dde88c997c1e8448819c5bc77
This change adds the test case from https://github.com/google/cctz/pull/337
PiperOrigin-RevId: 869318402
Change-Id: Ic6136aa56bf41e85e0ad42b6410c7430729bcd13
The hash quality ends up depending on the locations of bits in the values working well in conjunction with the polynomial used by crc32. We minimized probe benchmark geomean across the 64 possible rotation values (we see ~75% geomean improvement).
Benchmarks show improvements in lookup latency and hash quality. Loadtests are neutral or leaning positive.
ASM diff x86: https://godbolt.org/z/jvG1aY31e
ASM diff ARM: https://godbolt.org/z/dPdP6d6d8
ASM diff x86 hashtable lookup (simplified): https://godbolt.org/z/E9ehME647
PiperOrigin-RevId: 868281226
Change-Id: Ifc3bf79de50f15d3d74170911013ca19e73ee240
For example, \x100000041 could overflow a 32-bit integer and result in
0x41 ('A'), bypassing the exceeds 0xFF check. While this may be hard
to exploit, it is better to be safe and correct.
PiperOrigin-RevId: 868181068
Change-Id: I7d7763e0fe248f7cd7a4cfcc73554d7b20355795
This library contains helper functions that allow throwing exceptions
consistently from anywhere, without risk of ODR violations. When
execptions are disabled, these functions abort the program.
The old internal spellings will be removed in a follow up change.
PiperOrigin-RevId: 867594519
Change-Id: Ibd7a447f5577247bced718617f5da662d983d185
Currently, when Abseil Hardened Fast is set and NDEBUG is set,
ABSL_UNREACHABLE performs undefined behavior, as the assert is a no-op
and the various ABSL_UNREACHABLE_IMPLs can in fact be reached, violating
assumptions we have told the compiler to make.
PiperOrigin-RevId: 866148746
Change-Id: I4fcad9681d167c40be082521c3bebd9fc27109dc
Enabling downcast validation checks has incurred about 0.5% overhead on some Google workloads. Consequently it does not seem like a good inclusion in Abseil Hardened Fast mode, though it remains enabled in Abseil Hardened Extensive mode.
PiperOrigin-RevId: 866108195
Change-Id: Ic796e8bce90bb0d80ad60269a0b3857f19f2c95c
This is to allow using Abseil in GoogleTest, which would allow use of RE2.
PiperOrigin-RevId: 865975476
Change-Id: Ifdf62384b82a14e0fb569076333bee96647e7c1f
This requires a GoogleTest dependency update for compatibility
The use of --action_env for setting up the compiler is changed
because of https://github.com/bazelbuild/bazel/issues/26222
Also fix the path to the symbolizer in sanitizer builds
PiperOrigin-RevId: 865570744
Change-Id: I403202956913519c714d6eed4968a9615853ac42
The docker images for Linux have all been combined into a single image
that contain the latest and minimum versions of GCC that are
supported, along with a recent Clang and both a normal and a
TSAN-instrumented libc++. Bazel is now Bazelisk, which allows for
easier testing of other Bazel versions.
Summary:
Linux Clang x86_64: 22.1.0-rc2 (needed to test a C++26 feature)
Linux Clang aarch64: 21.1.8 (the latest release candidate is broken on ARM)
GCC latest: 15.2.0
GCC floor: 9.5.0
Bazel 8.5.1
CMake 4.2.3
MacOS and Windows is also updated to Bazel 8.5.1 so the vendor cache,
which is dependent on the Bazel version, also works on these
platforms.
PiperOrigin-RevId: 864975917
Change-Id: I072f93164b8ecc0b3a6f2c3d0efecea5bdd05c02
```
name CYCLES/op CYCLES/op vs base
BM_HASHING_Combine_contiguous_Fleet_hot 704.0m ± 1% 564.5m ± 1% -19.82% (p=0.000 n=30)
BM_HASHING_Combine_contiguous_Fleet_cold 2.422 ± 1% 2.159 ± 2% -10.88% (p=0.000 n=30)
```
We implement exactly the same behavior as on X86. It may be improved for the following reasons:
1. `vaeseq_u8` do `^key` before encryption, but `_mm_aesenc_si128` do that after encryption. We workaround by doing manually `^key` at the end. That adds extra instruction. Note: just using `vaeseq_u8` produces bad hash quality.
2. `vaeseq_u8` and `vaesmcq_u8` are separate instructions on ARM, so we may combine instructions more efficiently.
3. Worth mentioning that separate behavior for ARM may complicate maintance.
llvm-mca:
1. 33-64 case shows +4 cycles. https://godbolt.org/z/47GacMYqE
2. 65+ case also shows +4 cycles. https://godbolt.org/z/19xaecs9x
3. -204 bytes of binary size: https://godbolt.org/z/KcjEMb8Pv
Microbenchmarks are showing visible win, so likely reduction in micro-ops and number of loads compensate latency increase reported by llvm-mca.
PiperOrigin-RevId: 863270586
Change-Id: I9f867d00a8c147bdd1a482f38aca9f95cce9a58e
decoupling code that uses time from the code that creates a point in
time. You can use this to your advantage by injecting Clocks into
interfaces rather than having implementations call absl::Now()
directly. absl::Clock::GetRealClock() returns an absl::Clock backed by
absl::Now().
Add absl::SimulatedClock, a test-only Clock implementation that does
not "tick" on its own. Time is advanced by explicit calls to the
AdvanceTime() or SetTime() functions. This is intended to be used for
dependency injection in tests to test how code behaves under simulated
time conditions.
PiperOrigin-RevId: 862858341
Change-Id: Ied9946dd84063c95505269971d3c996d4b66c6d8
Library features are not predefined and are only available if you include `<version>` or the relavent standard library header providing this feature. This header guards inclusion of `<functional>` using the feature detection macro, of which the header actually defines it. So depending on include order, the effective `absl::bind_front` may be `std::bind_front` or the polyfill implementation.
PiperOrigin-RevId: 859719650
Change-Id: I8a2fbad004ef5e86ac43058ae7bfe39878ea7907
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1993
leak sanitizer is not supported on windows, when compiling with clang
on window we get:
```
lld-link: error: undefined symbol: __lsan_do_recoverable_leak_check
>>> referenced by abseil-cpp\absl\debugging\leak_check.cc:46
```
Merge 8c07b9ca7c into 889ddc99e1
Merging this change closes#1993
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1993 from kalman5:patch-1 8c07b9ca7c
PiperOrigin-RevId: 859108154
Change-Id: I12c2b6ae250ba6afb05736c0c04007aa0aa187c4
StringResizeAndOverwriteImpl()
This change bridges the gap between the legacy uninitialized resize
behavior and the modern absl::StringResizeAndOverwrite(). The internal
StringResizeAndOverwriteImpl function is used directly because the
public Abseil API requires the buffer to be initialized, whereas these
legacy functions rely on the behavior of leaving it uninitialized
(which is technically UB but relied upon here).
This is part of the work to migrate away from these legacy
utilities.
PiperOrigin-RevId: 855779916
Change-Id: If22484048024eae8ddedd29ebb08e8884e0198a3
Currently, clang isn't using blsr to clear the least significant bit because we are using uint16_t as the bitmask integer type and there are only blsr instructions for 32 and 64 bit registers. When we change to use uint32_t, clang generates blsr, but it also adds an unnecessary movzx (zero-extending move) even though the high bits of the output of vpmovmskb are zeroed. In order to avoid this problem, we use inline asm.
PiperOrigin-RevId: 854341062
Change-Id: I38b7e8913bf76ffd8e94b081afb52128fbcb795d