Derek Mauro
3006ff8b41
Use a proper fix instead of a workaround for a parameter annotated
...
absl_nonnull since the latest Clang can see through the workaround
PiperOrigin-RevId: 764428456
Change-Id: I88398f924333a72abb39ffb87ecbd02f751d89eb
2025-05-28 14:56:09 -07:00
Evan Brown
8a5cefc62a
Assert that SetCtrl isn't called on small tables - there are no control bytes in such cases.
...
Fix a case of calling SetCtrl for small tables in FindNewPositionsAndTransferSlots.
PiperOrigin-RevId: 764373106
Change-Id: Ie50573013291846d48d6e2d25775229d47cedeac
2025-05-28 12:39:20 -07:00
Vitaly Goldshteyn
94be0866ac
Use MaskFullOrSentinel in skip_empty_or_deleted.
...
```
name old INSTRUCTIONS/op new INSTRUCTIONS/op delta
BM_Iteration/1/1 18.0 ± 0% 16.0 ± 0% -11.11% (p=0.000 n=157+157)
BM_Iteration/2/2 42.0 ± 0% 36.0 ± 0% -14.29% (p=0.000 n=137+130)
BM_Iteration/4/4 71.1 ±21% 61.3 ± 1% -13.80% (p=0.000 n=157+101)
BM_Iteration/7/7 74.0 ± 0% 60.0 ± 0% -18.92% (p=0.000 n=157+157)
BM_Iteration/10/10 139 ±20% 115 ±20% -16.75% (p=0.000 n=157+157)
BM_Iteration/15/15 235 ±18% 193 ±18% -17.98% (p=0.000 n=152+157)
BM_Iteration/16/16 241 ±20% 199 ±21% -17.79% (p=0.000 n=157+157)
BM_Iteration/54/54 573 ± 9% 455 ± 7% -20.50% (p=0.000 n=157+157)
BM_Iteration/100/100 1.11k ± 7% 0.88k ± 6% -20.76% (p=0.000 n=157+154)
BM_Iteration/400/400 4.42k ± 4% 3.48k ± 4% -21.11% (p=0.000 n=157+157)
BM_Iteration/100/1 125 ± 8% 111 ± 0% -10.93% (p=0.000 n=135+131)
BM_Iteration/1000/10 1.69k ± 2% 1.42k ± 1% -16.22% (p=0.000 n=156+149)
name old CYCLES/op new CYCLES/op delta
BM_Iteration/1/1 5.02 ± 1% 5.00 ± 0% -0.41% (p=0.000 n=149+156)
BM_Iteration/2/2 9.61 ±13% 8.08 ± 2% -15.87% (p=0.000 n=157+130)
BM_Iteration/4/4 18.4 ±16% 16.5 ±19% -10.33% (p=0.000 n=127+124)
BM_Iteration/7/7 21.0 ± 0% 13.2 ± 2% -37.39% (p=0.000 n=156+136)
BM_Iteration/10/10 37.5 ±52% 35.2 ±52% -5.97% (p=0.007 n=157+157)
BM_Iteration/15/15 87.4 ±41% 81.2 ±45% -7.10% (p=0.000 n=151+157)
BM_Iteration/16/16 88.9 ±48% 82.7 ±45% -6.98% (p=0.001 n=157+157)
BM_Iteration/54/54 159 ±27% 152 ±31% -4.81% (p=0.001 n=154+155)
BM_Iteration/100/100 365 ±25% 345 ±28% -5.49% (p=0.000 n=157+157)
BM_Iteration/400/400 1.54k ±13% 1.43k ±13% -7.16% (p=0.000 n=157+157)
BM_Iteration/100/1 77.5 ±14% 29.8 ±29% -61.50% (p=0.000 n=157+157)
BM_Iteration/1000/10 2.00k ± 3% 0.41k ±10% -79.54% (p=0.000 n=152+156)
```
PiperOrigin-RevId: 763944602
Change-Id: Ibb3aa34485dd9fc06346304d7a6ff6fb348afb6c
2025-05-27 14:17:19 -07:00
Evan Brown
501d0a586e
Reduce flakiness in MockDistributions.Examples test case.
...
PiperOrigin-RevId: 763928380
Change-Id: I2063b45e660a9601bb52d72963b19803863c5c36
2025-05-27 13:37:25 -07:00
Evan Brown
942af4809b
Rename PrepareInsertNonSoo to PrepareInsertLarge now that it's no longer used in all non-SOO cases.
...
Also, rename SmallNonSooPrepareInsert for consistency.
PiperOrigin-RevId: 763902938
Change-Id: Ie3893932b61a59d195dc96193574a982e40c3b41
2025-05-27 12:32:22 -07:00
Hannah Shi
8718e816c5
PR #1895 : use c++17 in podspec
...
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1895
Abseil requires C++ 17, set it in generated podspec
Merge 03f6a39f50 into e4c43850ad
Merging this change closes #1895
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1895 from HannahShiSFB:use-cpp-17-in-podspec 03f6a39f50
PiperOrigin-RevId: 763879584
Change-Id: Ie1e3dc6f9943813a8a6cdeacfa6d122d81365ee6
2025-05-27 11:33:19 -07:00
Evan Brown
bd4bfed9ba
Avoid hashing the key in prefetch() for small tables.
...
Also:
- Assert that we aren't reading control when the table has capacity 0 because it is uninitialized in that case.
- Use [[maybe_unused]] instead of cast to void.
- Add NOLINT for erroneous "assert can be static_assert" lint warning.
PiperOrigin-RevId: 763859124
Change-Id: Id8b8acb24882357e75cfe751e9b62fb94befddfa
2025-05-27 10:46:19 -07:00
Abseil Team
e4c43850ad
Remove template alias nullability annotations.
...
These were deprecated before the last LTS release.
PiperOrigin-RevId: 762205726
Change-Id: I9d15a08967086296ecc9650a7ae0ae9c4973c405
2025-05-22 18:22:59 -07:00
Vitaly Goldshteyn
9d51fa7835
Add Group::MaskFullOrSentinel implementation without usage.
...
It is intended to be used for optimization experiments for iteration.
PiperOrigin-RevId: 761692460
Change-Id: Ia642e2f3a627ee24d4a09ef2edb8948d49206699
2025-05-21 15:31:32 -07:00
Vitaly Goldshteyn
4e94319de3
Move hashtable_control_bytes tests into their own file.
...
PiperOrigin-RevId: 761584628
Change-Id: I39fd1b14ae71754e058e23305761a2e43d9e989a
2025-05-21 10:48:41 -07:00
Vitaly Goldshteyn
282d0fcc08
Simplify calls to EqualElement by introducing equal_to helper function.
...
I am marking one liner helper functions as `ABSL_ATTRIBUTE_ALWAYS_INLINE` to avoid them ending up as weak symbols for the linker.
PiperOrigin-RevId: 761180450
Change-Id: I3593a5a9e8317df7714715608bc7309c3fcc8bbb
2025-05-20 12:15:50 -07:00
Vitaly Goldshteyn
5914831e6d
Do common.increment_size() directly in SmallNonSooPrepareInsert if inserting to reserved 1 element table.
...
That avoids `policy.soo_enabled` branch and makes the function slightly smaller.
Also removed update of unused `growth_info` in `IncrementSmallSize`. `IncrementSmallSize` is only used in `Copy` now.
PiperOrigin-RevId: 761141482
Change-Id: I5f46a1a239faa5205b53c9bf1289ff742cb9cace
2025-05-20 10:39:41 -07:00
Abseil Team
0c0879586e
Import of CCTZ from GitHub.
...
PiperOrigin-RevId: 761092464
Change-Id: I8497e9c9a034d222e48815732fd5f9b1103b7d51
2025-05-20 08:24:06 -07:00
Vitaly Goldshteyn
05ba922c12
Small cleanup of infoz processing to get the logic out of the line or removed.
...
1. For SOO growth from 1 to 3: remove recording since table couldn't be sampled in full SOO state.
2. For non-SOO growth for 0 to 1 and from 1 to 3: move reporting out of the line and reuse the code.
Microbenchmarks show some wins for SOO case.
```
name old CYCLES/op new CYCLES/op delta
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1 14.2 ± 0% 14.2 ± 0% -0.15% (p=0.000 n=51+47)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:2 34.4 ± 0% 32.4 ± 0% -5.83% (p=0.000 n=51+54)
```
PiperOrigin-RevId: 761052883
Change-Id: Icfe1503e5234af6f1b61fee12078d0e0cebbfcac
2025-05-20 06:15:05 -07:00
Vitaly Goldshteyn
f0835ec75b
Extract the entire PrepareInsert to Small non SOO table out of the line.
...
Also introduced specialized `Grow1To3AndPrepareInsert`. I have moved generation of seed into that function, because we do not need a seed for a small table (capacity = 1). That eliminates the cost of seed generation for tables that never grew above size 1.
At the moment code in `Grow1To3AndPrepareInsert` has a lot of similarities to `GrowSooTableToNextCapacityAndPrepareInsert`. But there are already differences that are not easy to generalize. Implementations would likely/definitely diverge more in the future.
```
name old INSTRUCTIONS/op new INSTRUCTIONS/op delta
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1 39.1 ± 0% 39.1 ± 0% ~ (all samples are equal)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:2 116 ± 0% 116 ± 0% ~ (p=0.732 n=51+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:4 147 ± 0% 145 ± 0% -1.19% (p=0.000 n=51+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:8 135 ± 0% 133 ± 0% -1.30% (p=0.000 n=51+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:16 139 ± 0% 138 ± 0% -0.72% (p=0.000 n=52+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:32 134 ± 0% 134 ± 0% -0.42% (p=0.000 n=51+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:64 128 ± 0% 128 ± 0% -0.24% (p=0.000 n=52+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:128 123 ± 0% 122 ± 0% -0.14% (p=0.000 n=48+49)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:256 119 ± 0% 119 ± 0% -0.08% (p=0.000 n=52+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:512 116 ± 0% 116 ± 0% -0.04% (p=0.000 n=51+46)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1024 115 ± 0% 115 ± 0% -0.02% (p=0.000 n=50+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:2048 113 ± 0% 113 ± 0% -0.01% (p=0.000 n=46+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:4096 113 ± 0% 113 ± 0% -0.01% (p=0.000 n=50+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:8192 113 ± 0% 113 ± 0% -0.01% (p=0.000 n=48+46)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:16384 112 ± 0% 112 ± 0% -0.00% (p=0.000 n=46+44)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:32768 112 ± 0% 112 ± 0% ~ (p=0.255 n=53+54)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:65536 112 ± 0% 112 ± 0% ~ (p=0.625 n=52+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:131072 112 ± 0% 112 ± 0% ~ (p=0.088 n=55+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:262144 112 ± 0% 112 ± 0% ~ (p=0.875 n=50+45)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:524288 112 ± 0% 112 ± 0% +0.00% (p=0.000 n=47+43)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1048576 112 ± 0% 112 ± 0% +0.00% (p=0.049 n=47+49)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:1 189 ± 0% 180 ± 0% -4.76% (p=0.000 n=56+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:2 237 ± 0% 228 ± 0% -4.01% (p=0.000 n=52+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:4 221 ± 0% 215 ± 0% -2.93% (p=0.000 n=56+43)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:8 186 ± 0% 182 ± 0% -2.22% (p=0.000 n=52+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:16 175 ± 0% 173 ± 0% -1.25% (p=0.000 n=52+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:32 162 ± 0% 161 ± 0% -0.71% (p=0.000 n=53+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:64 152 ± 0% 151 ± 0% -0.40% (p=0.000 n=49+49)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:128 144 ± 0% 144 ± 0% -0.22% (p=0.000 n=49+49)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:256 140 ± 0% 139 ± 0% -0.12% (p=0.000 n=53+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:512 136 ± 0% 136 ± 0% -0.06% (p=0.000 n=50+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:1024 134 ± 0% 134 ± 0% -0.03% (p=0.000 n=49+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:2048 134 ± 0% 134 ± 0% -0.06% (p=0.000 n=52+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:4096 133 ± 0% 133 ± 0% -0.01% (p=0.045 n=53+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:8192 133 ± 0% 133 ± 0% ~ (p=0.119 n=56+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:16384 132 ± 0% 132 ± 0% ~ (p=0.843 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:32768 132 ± 0% 132 ± 0% ~ (p=0.209 n=57+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:65536 132 ± 0% 132 ± 0% +0.02% (p=0.047 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:131072 131 ± 0% 131 ± 0% ~ (p=0.642 n=51+54)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:262144 131 ± 0% 131 ± 0% ~ (p=0.217 n=44+49)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:524288 131 ± 0% 131 ± 0% -0.01% (p=0.002 n=57+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:1048576 131 ± 0% 131 ± 0% +0.01% (p=0.000 n=57+44)
name old CYCLES/op new CYCLES/op delta
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1 14.2 ± 0% 14.2 ± 0% -0.35% (p=0.000 n=54+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:2 33.3 ± 0% 34.4 ± 0% +3.33% (p=0.000 n=42+46)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:4 47.4 ± 0% 47.0 ± 0% -0.89% (p=0.000 n=49+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:8 46.4 ± 0% 46.0 ± 0% -0.90% (p=0.000 n=48+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:16 50.0 ± 1% 49.2 ± 1% -1.65% (p=0.000 n=53+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:32 50.6 ± 1% 50.1 ± 1% -0.96% (p=0.000 n=54+54)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:64 50.9 ± 0% 50.9 ± 0% -0.19% (p=0.000 n=55+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:128 49.4 ± 1% 49.5 ± 1% +0.16% (p=0.000 n=54+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:256 47.6 ± 2% 47.9 ± 2% +0.80% (p=0.000 n=51+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:512 45.4 ± 2% 45.6 ± 2% +0.48% (p=0.000 n=53+54)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1024 44.1 ± 1% 44.3 ± 1% +0.49% (p=0.000 n=49+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:2048 43.2 ± 1% 43.3 ± 1% +0.24% (p=0.001 n=54+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:4096 42.7 ± 1% 42.8 ± 1% +0.23% (p=0.000 n=54+54)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:8192 42.7 ± 0% 42.7 ± 1% +0.14% (p=0.003 n=55+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:16384 43.0 ± 0% 43.0 ± 1% +0.07% (p=0.044 n=57+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:32768 43.5 ± 0% 43.6 ± 0% +0.13% (p=0.000 n=53+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:65536 44.3 ± 1% 44.4 ± 1% +0.12% (p=0.001 n=55+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:131072 45.3 ± 1% 45.3 ± 1% +0.15% (p=0.004 n=56+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:262144 46.8 ± 2% 47.0 ± 2% +0.56% (p=0.012 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:524288 49.5 ± 1% 49.6 ± 1% ~ (p=0.061 n=49+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 4>/set_size:1048576 53.7 ± 2% 53.7 ± 2% ~ (p=0.538 n=55+51)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:1 53.8 ± 0% 52.2 ± 0% -2.93% (p=0.000 n=52+53)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:2 68.2 ± 0% 65.3 ± 0% -4.26% (p=0.000 n=52+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:4 65.3 ± 2% 64.3 ± 3% -1.65% (p=0.000 n=56+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:8 59.5 ± 4% 58.3 ± 2% -1.93% (p=0.000 n=57+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:16 59.7 ± 2% 59.1 ± 1% -0.93% (p=0.000 n=52+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:32 58.5 ± 2% 58.2 ± 1% -0.47% (p=0.000 n=50+46)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:64 59.0 ± 3% 58.2 ± 2% -1.29% (p=0.000 n=57+52)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:128 57.9 ± 2% 57.3 ± 2% -1.05% (p=0.000 n=54+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:256 61.8 ± 3% 61.3 ± 3% -0.74% (p=0.000 n=56+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:512 60.6 ± 2% 60.2 ± 2% -0.68% (p=0.000 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:1024 59.9 ± 3% 59.5 ± 3% -0.58% (p=0.000 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:2048 60.0 ± 3% 59.7 ± 4% -0.56% (p=0.000 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:4096 65.3 ± 3% 65.1 ± 4% -0.40% (p=0.005 n=57+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:8192 74.8 ± 3% 74.4 ± 4% -0.55% (p=0.042 n=55+56)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:16384 79.5 ± 2% 79.4 ± 3% ~ (p=0.198 n=56+57)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:32768 83.4 ± 2% 83.3 ± 2% ~ (p=0.683 n=57+49)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:65536 86.6 ± 2% 86.8 ± 3% ~ (p=0.230 n=55+54)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:131072 98.2 ±10% 97.5 ± 7% ~ (p=0.575 n=56+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:262144 157 ± 6% 156 ± 4% ~ (p=0.081 n=52+50)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:524288 172 ± 7% 173 ± 7% ~ (p=0.561 n=57+55)
BM_SWISSMAP_InsertManyToEmpty_Hot<::absl::flat_hash_set, 64>/set_size:1048576 185 ± 4% 185 ± 7% ~ (p=0.724 n=57+56)
```
PiperOrigin-RevId: 761022848
Change-Id: Ia9f71fa1f32a5549696662dd13195775a2746beb
2025-05-20 04:29:41 -07:00
Vitaly Goldshteyn
01acaa9089
Take get_hash implementation out of the SwissTable class to minimize number of instantiations.
...
Tables with the same key and hash would have the same instantiation.
PiperOrigin-RevId: 761014089
Change-Id: I2eafb43b440f54127ffa48aaf18e9a03eeca888d
2025-05-20 04:03:18 -07:00
Evan Brown
7b61c35cde
Change kEmptyGroup to kDefaultIterControl now that it's only used for default-constructed iterators.
...
PiperOrigin-RevId: 760696829
Change-Id: Ica318414c6562d16a3eac291c38eb2b171519c29
2025-05-19 11:11:27 -07:00
Jesse Rosenstock
fc0b7a083b
[bits] Add tests for return types
...
With gcc <= 12, std::bit_width<T>() returns T, not int, so make sure the
absl:: equivalents return the correct type.
https://github.com/abseil/abseil-cpp/issues/1890
PiperOrigin-RevId: 760612745
Change-Id: Ibbbe6eaa1aab677ecd747cf40765f6443eefe628
2025-05-19 07:13:25 -07:00
Evan Brown
41a1f434d4
Avoid allocating control bytes in capacity==1 swisstables.
...
PiperOrigin-RevId: 759275918
Change-Id: Id4e88ae026e3ebee04f5bdb28a7191e54aaea1e9
2025-05-15 13:27:38 -07:00
Ben Beasley
be5661825b
PR #1888 : Adjust Table.GrowExtremelyLargeTable to avoid OOM on i386
...
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1888
While this only covers `i386`/`i686`, which is the motivation for this PR, this test can be expected to OOM on any 32-bit platform. For now, this is the minimal change that avoids the problem [in the Fedora package](https://src.fedoraproject.org/rpms/abseil-cpp/ ).
This fixes one of the two test failures reported in https://github.com/abseil/abseil-cpp/issues/1887 .
Merge 395acb74da into f28774a282
Merging this change closes #1888
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1888 from musicinmybrain:extremely-large-table-32-bit 395acb74da
PiperOrigin-RevId: 759154889
Change-Id: I0a105fc42c51898c277b4a056ccd6599b43e1a50
2025-05-15 08:15:37 -07:00
Vitaly Goldshteyn
f28774a282
Avoid mixing after Hash64 calls for long strings by passing state instead of Seed to low level hash.
...
```
name old INSTRUCTIONS/op new INSTRUCTIONS/op delta
BM_latency_AbslHash_Int32 9.00 ± 0% 9.00 ± 0% ~ (all samples are equal)
BM_latency_AbslHash_Int64 9.00 ± 0% 9.00 ± 0% ~ (all samples are equal)
BM_latency_AbslHash_String3 32.0 ± 0% 32.0 ± 0% ~ (all samples are equal)
BM_latency_AbslHash_String5 30.9 ± 3% 31.0 ± 4% ~ (p=0.328 n=54+56)
BM_latency_AbslHash_String9 29.0 ± 4% 28.9 ± 3% ~ (p=0.413 n=55+53)
BM_latency_AbslHash_String17 27.0 ± 3% 27.4 ± 2% +1.74% (p=0.000 n=53+50)
BM_latency_AbslHash_String33 32.5 ± 5% 32.9 ± 6% +1.23% (p=0.002 n=55+52)
BM_latency_AbslHash_String65 63.6 ±14% 55.9 ±11% -12.02% (p=0.000 n=56+51)
BM_latency_AbslHash_String257 134 ±10% 122 ±10% -8.91% (p=0.000 n=52+49)
name old CYCLES/op new CYCLES/op delta
BM_latency_AbslHash_Int32 16.1 ± 2% 16.0 ± 4% ~ (p=0.108 n=51+56)
BM_latency_AbslHash_Int64 16.5 ± 4% 16.4 ± 5% ~ (p=0.074 n=54+54)
BM_latency_AbslHash_String3 22.7 ± 1% 22.6 ± 0% -0.50% (p=0.000 n=54+53)
BM_latency_AbslHash_String5 22.9 ± 8% 22.5 ± 7% -2.08% (p=0.011 n=56+55)
BM_latency_AbslHash_String9 23.1 ±15% 22.1 ± 7% -4.62% (p=0.000 n=57+52)
BM_latency_AbslHash_String17 21.7 ± 8% 21.4 ± 3% -1.54% (p=0.001 n=55+55)
BM_latency_AbslHash_String33 23.5 ± 4% 23.6 ± 5% ~ (p=0.206 n=53+53)
BM_latency_AbslHash_String65 32.5 ± 8% 28.8 ± 7% -11.29% (p=0.000 n=57+53)
BM_latency_AbslHash_String257 51.7 ± 9% 46.5 ± 7% -9.93% (p=0.000 n=54+50)
```
PiperOrigin-RevId: 759037628
Change-Id: I22e8c8e777901906015a29377b0ebd9c33310cf0
2025-05-15 01:37:55 -07:00
Abseil Team
2fe3c4b14e
Indent absl container examples consistently
...
PiperOrigin-RevId: 759023113
Change-Id: I84d18d16abddf70a00160e2bc3c25d5a90f52e79
2025-05-15 00:46:16 -07:00
Abseil Team
48e429c986
Revert- Doesn't actually work because SWIG doesn't use the full preprocessor
...
PiperOrigin-RevId: 758810429
Change-Id: Ic75609eacf736712851605d346b4c6ba1dc6cc1b
2025-05-14 13:28:37 -07:00
Vitaly Goldshteyn
fdf821ec60
Add tags to skip some tests under UBSAN.
...
PiperOrigin-RevId: 758783019
Change-Id: I3b5d6a7cce9a001a7dbc3edb9dd5c7e9132b33dd
2025-05-14 12:14:46 -07:00
Vitaly Goldshteyn
bc354a995c
Avoid subtracting it.control() and table.control() in single element table during erase.
...
`it.control()` is pointing to `kSooControl` global buffer. The result of subtraction is not used, but that causes UBSAN pointer overflow error.
PiperOrigin-RevId: 758683515
Change-Id: Ifa9e3f7f2da3de371dd65f3e1d42c77c20aece59
2025-05-14 07:58:10 -07:00
Vitaly Goldshteyn
472365f856
Remove the salt parameter from low level hash and use a global constant. That may potentially remove some loads.
...
Also remove `LowLevelHashImpl` since it is adding an indirection to save the passing Seed() argument that is likely already in the register.
```
name old CYCLES/op new CYCLES/op delta
BM_latency_AbslHash_Int32 16.1 ± 2% 16.0 ± 3% ~ (p=0.249 n=49+55)
BM_latency_AbslHash_Int64 16.5 ± 3% 16.5 ± 3% ~ (p=0.862 n=51+50)
BM_latency_AbslHash_String3 22.6 ± 0% 22.6 ± 1% +0.11% (p=0.012 n=54+55)
BM_latency_AbslHash_String5 22.9 ±10% 22.9 ± 8% ~ (p=0.566 n=57+56)
BM_latency_AbslHash_String9 22.9 ±14% 23.2 ±13% ~ (p=0.640 n=56+57)
BM_latency_AbslHash_String17 21.9 ±10% 21.9 ± 7% ~ (p=0.409 n=52+55)
BM_latency_AbslHash_String33 23.6 ± 4% 23.4 ± 5% ~ (p=0.098 n=53+55)
BM_latency_AbslHash_String65 34.0 ±11% 32.5 ± 8% -4.41% (p=0.000 n=56+56)
BM_latency_AbslHash_String257 53.0 ± 7% 52.3 ± 8% -1.31% (p=0.037 n=53+50)
```
PiperOrigin-RevId: 758656004
Change-Id: I9e828cde7d181da813aa8228b73d208ba7dc9042
2025-05-14 06:32:35 -07:00
Evan Brown
bf98162082
In SwissTable, don't hash the key when capacity<=1 on insertions.
...
This is applying SOO-like hashing behavior for small non-SOO-enabled tables.
Note that now we don't use the control bytes for capacity==1 tables, but we still allocate them. I left not allocating the control bytes in such cases as a followup.
PiperOrigin-RevId: 758373480
Change-Id: I152b313b7d770eb10fd6d175b5d9a07801274436
2025-05-13 14:19:47 -07:00
Evan Brown
ebb23039de
Remove the "small" size designation for thread_identity_test, which causes the test to timeout after 60s.
...
Motivation: this test times out flakily in some build configurations.
PiperOrigin-RevId: 758364551
Change-Id: Ic988ec988ddb51439875cba30b137348c59457ee
2025-05-13 13:58:35 -07:00
Abseil Team
e94af2deb9
Add comment explaining math behind expressions.
...
PiperOrigin-RevId: 758333843
Change-Id: Icca99ea0d88caa6907be8f22ff23df18a2992892
2025-05-13 12:41:59 -07:00
Abseil Team
30eea9b0d0
Exclude SWIG from ABSL_DEPRECATED and ABSL_DEPRECATE_AND_INLINE
...
PiperOrigin-RevId: 758254733
Change-Id: I3f60d8117e4a37452409e28e706d677ef258c849
2025-05-13 09:35:40 -07:00
Wiktor Garbacz
d55845e6c1
stacktrace_x86: Handle nested signals on altstack
...
PiperOrigin-RevId: 758147101
Change-Id: I569e095b4820862a7ebba68bd22ab205f43693e2
2025-05-13 03:49:25 -07:00
Abseil Team
9c8e8f948b
Import of CCTZ from GitHub.
...
PiperOrigin-RevId: 757934622
Change-Id: Ie22189d81f8432428d64847cf422aae5d9437105
2025-05-12 15:25:40 -07:00
Evan Brown
9109163f1c
Simplify MixingHashState::Read9To16 to not depend on endianness.
...
PiperOrigin-RevId: 757933213
Change-Id: Ia4ce9f196e8098931c748600997b977811bb7e85
2025-05-12 15:22:03 -07:00
Abseil Team
309adff2a5
Delete deprecated absl::Cord::Get and its remaining call sites.
...
PiperOrigin-RevId: 757900896
Change-Id: I0b56fcbcbd82d2decd1b59676a7af55d868be5a4
2025-05-12 13:57:28 -07:00
Thomas Schenker
9768012425
PR #1884 : Remove duplicate dependency
...
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1884
Remove a duplicated dependency to `absl::tracing_internal`.
Merge 6805baed96 into 9a89ea8714
Merging this change closes #1884
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1884 from schenker:delete-duplicate-dependency 6805baed96
PiperOrigin-RevId: 757896259
Change-Id: I3eecc788e2ec995bd1320345749b5fe4046cbea4
2025-05-12 13:46:41 -07:00
Derek Mauro
80b767438f
Remove relocatability test that is no longer useful
...
PiperOrigin-RevId: 757895298
Change-Id: Id0a981b11499abc1471fe70589cfd5dfa13a9c2b
2025-05-12 13:44:49 -07:00
Abseil Team
9a89ea8714
Import of CCTZ from GitHub.
...
PiperOrigin-RevId: 756908046
Change-Id: I4db2b90fd1f6097f582b90c6aa82cdc4704d8b66
2025-05-09 14:29:41 -07:00
Evan Brown
4bf37d8e19
Fix a bug of casting sizeof(slot_type) to uint16_t instead of uint32_t.
...
Note that in the above static_assert, we check that sizeof(slot_type) fits in a uint32_t, not a uint16_t and the field in PolicyFunctions is a uint32_t.
PiperOrigin-RevId: 756886567
Change-Id: I5ca915b814d1da6cdc1d24152b2ebde5dec9d28b
2025-05-09 13:30:30 -07:00
Omer Mor
83e249f264
Rewrite WideToUtf8 for improved readability.
...
This is supposed to be a zero-diff change.
PiperOrigin-RevId: 756859112
Change-Id: Ia81a84bc5d1e6f2a1299ca0ff5dbcec48583ab76
2025-05-09 12:12:44 -07:00
Abseil Team
3eb2041985
Avoid requiring default-constructability of iterator type in algorithms that use ContainerIterPairType
...
This includes absl::c_minmax_element, absl::c_equal_range, and absl::mismatch
PiperOrigin-RevId: 756846820
Change-Id: I39f612224a98947f5ef9e9b7e53320df0bd99ce7
2025-05-09 11:40:36 -07:00
Omer Mor
0710718aca
Added test cases for invalid surrogates sequences.
...
While these are disabled now because the current implementation does not correctly handle them, this is a starting point for a future fix.
PiperOrigin-RevId: 756431459
Change-Id: I9c498ce1a2e12baa32a46bcdc56e9354feee305a
2025-05-08 13:14:10 -07:00
Derek Mauro
a4950fba03
Use __builtin_is_cpp_trivially_relocatable to implement
...
absl::is_trivially_relocatable in a way that is compatible with PR2786
in the upcoming C++26.
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html
This change is being made now because Chromium is reporting that a
recent LLVM commit adds deprecation warnings for
__is_trivially_relocatable.
https://github.com/llvm/llvm-project/pull/138835
PiperOrigin-RevId: 756408712
Change-Id: Iacf966ed2ebfd436d52d180f0dab34465b3c7176
2025-05-08 12:12:17 -07:00
Omer Mor
db8171fd8b
Remove dependency on wcsnlen for string length calculation.
...
The `wcsnlen` function is not consistently available across all target environments. Its prior use was intended as a micro-optimization and safeguard to limit string scanning to the remaining buffer size and prevent potential issues with malformed strings lacking a null terminator.
This change now relies on the implicit `std::wstring_view` constructor to determine the string length. `CopyToEncodedBuffer` will continue to handle truncation effectively, mitigating the original concerns.
PiperOrigin-RevId: 756378282
Change-Id: I858bad01724507f7926f868aa300eabad8a4358c
2025-05-08 10:55:43 -07:00
Peter Collingbourne
1b52dcb350
Stop being strict about validating the "clone" part of mangled names
...
Support for parsing mangled symbol names with a ".something" suffix
in the demangler was originally added because the compiler was using
that for function cloning, but since then the compiler has started
using ".something" suffixes in many other cases, such as function
renaming for ThinLTO and CFI. As a result, some symbols in binaries
built with these features would fail to demangle.
So instead of trying to validate what comes after the "." let's just
stop parsing when we see a ".", so that the symbols are demangled
correctly. This behavior is consistent with libc++.
PiperOrigin-RevId: 756054147
Change-Id: I01e9e97eee32bee05ba243b615ed26a36b59591d
2025-05-07 16:38:36 -07:00
Omer Mor
bba13cb1ac
Add support for logging wide strings in absl::log.
...
The logged strings are truncated to fit the available buffer in the same way as regular strings.
Invalid characters are replaced by the replacement char (`U+FFFD`).
Wide string literals are recorded as literals in `logging.proto.Value`.
PiperOrigin-RevId: 756052375
Change-Id: If3960b4230f923061028bd738eb209b5a82a31eb
2025-05-07 16:32:42 -07:00
Omer Mor
464b5b366c
Deprecate ABSL_HAVE_STD_STRING_VIEW.
...
This macro is no longer necessary now that Abseil requires C++17.
PiperOrigin-RevId: 755992345
Change-Id: Id1361d62d860a0ba4bdfca22e8f39d54812ef82c
2025-05-07 13:52:30 -07:00
Derek Mauro
9fcfa0602d
Change some nullability annotations in absl::Span to
...
absl_nullability_unknown to workaround a bug that makes nullability
checks trigger in foreach loops, while still fixing the
-Wnullability-completeness warnings.
PiperOrigin-RevId: 755951074
Change-Id: Ia6eea53f381d9255856a3f85efa41f0dfbd5c684
2025-05-07 12:04:51 -07:00
Derek Mauro
cdd3d21fce
Linux CI update
...
GCC latest is now GCC-15.1
Clang on ARM is now Clang-19
Bazel 8.2.1
CMake 4.0.1
Enable Bazel "Vendor Mode" as a caching mechanism to reduce
GitHub download failures.
PiperOrigin-RevId: 755864516
Change-Id: I9bf38e20fb8a09739406798119c50ce1aa934f43
2025-05-07 08:27:23 -07:00
Derek Mauro
668f174945
Fix new -Wnullability-completeness warnings found after upgrading
...
the Clang version used in the Linux ARM CI to Clang 19.
nullability-completeness is an all-or-nothing warning, and it is
enabled by default. If anything is annotated, everything has to be
annotated.
There are a few types of fixes in this change. The most common is just
to add missing annotations. In a few cases, some SFINAE methods are
changed not to use pointers at all. In some cases, like
cord_internal.h, I removed the single annotation as that is easier
than doing the entire complicated file for now. cordz_test_helpers.h
uses GoogleTest macros, which bring in pointers that can't easily be
annotated, so I removed the annotations from this file as well.
Tests are also opted-out of the warning.
I'm not sure why the x86 Clang version didn't pick these issues up.
PiperOrigin-RevId: 755844859
Change-Id: I7d7f4cc4f6d779f52c86a4d96e07880341244491
2025-05-07 07:28:51 -07:00
Evan Brown
e3a2008867
Add __restrict for uses of PolicyFunctions.
...
This lets the compiler know that PolicyFunctions never aliases other variables so e.g. when we write to control bytes, we don't need to reload PolicyFunctions members that we've previously accessed.
PiperOrigin-RevId: 755493766
Change-Id: Ic7729a9726da00bcaabd064ffd046a6260dd6480
2025-05-06 13:13:54 -07:00