summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Optimize memcasecmp. Benchmarks shows slight improvement.Gravatar Ilya Tokar2023-10-30
| | | | | | | | | | | | | | | We are also avoiding potential cache-misses, by avoiding load. name old speed new speed delta BM_Searchcase 3.09GB/s ±13% 3.20GB/s ±16% +3.69% (p=0.039 n=20+17) BM_SearchcaseMedium 1.08GB/s ± 7% 1.04GB/s ±14% ~ (p=0.814 n=16+20) BM_SearchcasePathological 618kB/s ±13% 652kB/s ± 6% +5.55% (p=0.043 n=20+16) BM_Memcasematch 2.43GB/s ± 3% 2.45GB/s ± 3% ~ (p=0.488 n=17+16) BM_MemcasematchMedium 230MB/s ± 8% 261MB/s ±14% +13.77% (p=0.000 n=16+20) BM_MemcasematchPathological 624kB/s ±14% 619kB/s ±14% ~ (p=0.836 n=20+20) PiperOrigin-RevId: 577919033 Change-Id: I31324e04b6a577c582ad630d171d3b41d826f1e4
* Roll forward: Add sanitizer mode checks that element ↵Gravatar Evan Brown2023-10-30
| | | | | | | constructors/destructors don't make reentrant calls to raw_hash_set member functions. PiperOrigin-RevId: 577877803 Change-Id: I254c589b00cadec6ff95dfd60a8a38ab303c1af5
* Fix an unreachable code warning on some platformsGravatar Derek Mauro2023-10-30
| | | | | | | #1558 PiperOrigin-RevId: 577874842 Change-Id: I1d56f3f4b445f6c4a9df2fe06fec542cb00e0e92
* absl: speed up Mutex::LockGravatar Dmitry Vyukov2023-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently Mutex::Lock contains not inlined non-tail call: TryAcquireWithSpinning -> GetMutexGlobals -> LowLevelCallOnce -> init closure This turns the function into non-leaf with stack frame allocation and additional register use. Remove this non-tail call to make the function leaf. Move spin iterations initialization to LockSlow. Current Lock happy path: 00000000001edc20 <absl::Mutex::Lock()>: 1edc20: 55 push %rbp 1edc21: 48 89 e5 mov %rsp,%rbp 1edc24: 53 push %rbx 1edc25: 50 push %rax 1edc26: 48 89 fb mov %rdi,%rbx 1edc29: 48 8b 07 mov (%rdi),%rax 1edc2c: a8 19 test $0x19,%al 1edc2e: 75 0e jne 1edc3e <absl::Mutex::Lock()+0x1e> 1edc30: 48 89 c1 mov %rax,%rcx 1edc33: 48 83 c9 08 or $0x8,%rcx 1edc37: f0 48 0f b1 0b lock cmpxchg %rcx,(%rbx) 1edc3c: 74 42 je 1edc80 <absl::Mutex::Lock()+0x60> ... unhappy path ... 1edc80: 48 83 c4 08 add $0x8,%rsp 1edc84: 5b pop %rbx 1edc85: 5d pop %rbp 1edc86: c3 ret New Lock happy path: 00000000001eea80 <absl::Mutex::Lock()>: 1eea80: 48 8b 07 mov (%rdi),%rax 1eea83: a8 19 test $0x19,%al 1eea85: 75 0f jne 1eea96 <absl::Mutex::Lock()+0x16> 1eea87: 48 89 c1 mov %rax,%rcx 1eea8a: 48 83 c9 08 or $0x8,%rcx 1eea8e: f0 48 0f b1 0f lock cmpxchg %rcx,(%rdi) 1eea93: 75 01 jne 1eea96 <absl::Mutex::Lock()+0x16> 1eea95: c3 ret ... unhappy path ... PiperOrigin-RevId: 577790105 Change-Id: I20793534050302ff9f7a20aed93791c088d98562
* Rollback "Mutex: Remove destructor in release build"Gravatar Dmitry Vyukov2023-10-27
| | | | | PiperOrigin-RevId: 577180526 Change-Id: Iec53709456805ca8dc5327669cc0f6c95825d0e9
* Mutex: Remove destructor in release buildGravatar Dmitry Vyukov2023-10-27
| | | | | | | | | | | | | | | | The Mutex destructor is needed only to clean up debug logging and invariant checking synch events. These are not supposed to be used in production, but the non-empty destructor has costs for production builds. Instead of removing synch events in destructor, drop all of them if we accumulated too many. For tests is should not matter (we maybe only consume a bit more memory). Production builds should be either unaffected (if don't use debug logging), or use periodic reset of all synch events. PiperOrigin-RevId: 577106805 Change-Id: Icaaf7166b99afcd5dce92b4acd1be661fb72f10b
* Avoid using the non-portable type __m128i_u.Gravatar Derek Mauro2023-10-26
| | | | | | | | | | | | | | | | According to https://stackoverflow.com/a/68939636 it is safe to use __m128i instead. https://learn.microsoft.com/en-us/cpp/intrinsics/x86-intrinsics-list?view=msvc-170 also uses this type instead __m128i_u is just __m128i with a looser alignment requirement, but simply calling _mm_loadu_si128() instead of _mm_load_si128() is enough to tell the compiler when a pointer is unaligned. Fixes #1552 PiperOrigin-RevId: 576931936 Change-Id: I7c3530001149b360c12a1786c7e1832754d0e35c
* Prefer builtin to inline assembly when built with -mprfchw.Gravatar Chris Kennelly2023-10-26
| | | | | PiperOrigin-RevId: 576884571 Change-Id: I7bfe68e5aedd8563f8e6dbdb5d7cc66e9af22567
* PR #1553: Adapt to syscall(2) removal in OpenBSDGravatar Theo Buehler2023-10-25
| | | | | | | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1553 OpenBSD will remove its generic syscall(2) interface, so setting the ABSL_HAVE_SYSCALL_WRITE define will result in a linking failure soon. Make direct use of the write(2) syscall instead. OpenBSD's libc does not do any buffering for write, so there is no change of behavior. A [variant of this patch][1] has been in use since early this year in OpenBSD's ports. There's no need to set ABSL_LOW_LEVEL_WRITE_SUPPORTED since that's already done a few lines up. [1]: https://github.com/openbsd/ports/commit/5f9e56cd982c1f1fa5af867e56355091e1817786 Merge 0dcc88a3cdab513c598587d85423135e85cec330 into b841db22f8d1d9cdbaacecf2e7c87ce270f8d96f Merging this change closes #1553 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1553 from botovq:openbsd-syscall 0dcc88a3cdab513c598587d85423135e85cec330 PiperOrigin-RevId: 576552197 Change-Id: I13466703ddc9d50edf87da5d0c291aad642af49a
* absl: requeue waiters as LIFOGravatar Dmitry Vyukov2023-10-24
| | | | | | | | | | | Currently if a thread already blocked on a Mutex, but then failed to acquire the Mutex, we queue it in FIFO order again. As the result unlucky threads can suffer bad latency if they are requeued several times. The least we can do for them is to queue in LIFO order after blocking. PiperOrigin-RevId: 576174725 Change-Id: I9e2a329d34279a26bd1075b42e3217a5dc065f0a
* Fix a typo.Gravatar Abseil Team2023-10-24
| | | | | PiperOrigin-RevId: 576162408 Change-Id: Ib383bb744b5cb11b6cbc99f2323583e1d23d8ff1
* Add `AbslStringify()` support to `absl::Cord`Gravatar Abseil Team2023-10-24
| | | | | PiperOrigin-RevId: 576149980 Change-Id: I0a7e3df7a01edc78ee5d15d8d8e82e7bbc5fc0f3
* Performance improvements for `absl::AsciiStrToLower` and ↵Gravatar Abseil Team2023-10-23
| | | | | | | `absl::AsciiStrToUpper`. PiperOrigin-RevId: 575969640 Change-Id: If6ddc0a71debfe571c2739ec91fc99594bc36f88
* Use STL algorithms available since C++14 to implement containerGravatar Derek Mauro2023-10-20
| | | | | | | | | | | | algorithms (when possible). Prior to C++14, many STL container algorithms required size checks because because the second container only used one iterator as an input. This is not an issue for some algorithms since C++14 added two iterator versions. PiperOrigin-RevId: 575296640 Change-Id: I9e4fc8c75cba7cdb0cde10bdd7c5c75e07f414ae
* Use STL algorithms available since C++14 to implement absl::equal andGravatar Derek Mauro2023-10-20
| | | | | | | | | | absl::rotate. Prior to C++14 these were either polyfills or fixes for bugs in standard libraries. PiperOrigin-RevId: 575295101 Change-Id: Ie01e77fedadc879c73203d71babd40c87a419af3
* Add internal interface to determine if a SpinLock is cooperative.Gravatar Chris Kennelly2023-10-20
| | | | | | | | Some use cases of SpinLock need to verify that it is configured for non-cooperative scheduling. PiperOrigin-RevId: 575278400 Change-Id: Ic49f57a989a3f7f67e346a1ec545f4cd5b94f849
* Rollback use of --remote_download_minimal on Bazel CI buildsGravatar Derek Mauro2023-10-20
| | | | | PiperOrigin-RevId: 575273754 Change-Id: Iddd31524c86ff05c3c204a2e04250605a55448bc
* absl::string_view: Add support for starts_with() and ends_with()Gravatar Derek Mauro2023-10-20
| | | | | | | | | | | | | | | | when targeting at least C++20 These methods were added to C++20, so they are not available in earlier language standards. Users requiring compatibility prior to C++20 should use absl::StartsWith() and absl::EndsWith() from //absl/strings/match.h. Most users are not affected by this change. By default when targeting at least C++20 absl::string_view will be an alias for std::string_view. Only users that have modified //absl/base/options.h will see this change. PiperOrigin-RevId: 575238435 Change-Id: I7b03fde02c987b30b88c794640c2a616851997d1
* Optimize prefetch codegen.Gravatar Dmitry Vyukov2023-10-18
| | | | | | | | | | | | | | | | | | | | | | | | Currently we use "r" constraint to pass prefetched address. This forces the compiler to actually put it into a register. As the result some uses look as: 16bfb7c: 48 01 cf add %rcx,%rdi 16bfb7f: 0f 0d 0f prefetchw (%rdi) -- 16bfccf: 48 83 c1 60 add $0x60,%rcx 16bfcd3: 0f 0d 09 prefetchw (%rcx) Use "m" constraint instead. It's more relaxed and requires to just materialize the address in some form using whatever addressing modes the target supports (e.g. x86 off(base, index, scale)). With the change the same code becomes: 16bfb7c: 0f 0d 0c 39 prefetchw (%rcx,%rdi,1) -- 16bfccf: 0f 0d 49 60 prefetchw 0x60(%rcx) PiperOrigin-RevId: 574723975 Change-Id: Id0c8645f8c702d1842685343901da321f6513156
* Add a template gadget to detect whether a type supports the ostream operator.Gravatar Zie Weaver2023-10-18
| | | | | | | | | | I.e. for a type `Example`, if ``` std::ostream& operator<<(std::ostream&, const Example&); ``` is declared, `absl::HasOstreamOperator<Example>::value` is `true`. PiperOrigin-RevId: 574637891 Change-Id: I123d8f35a6e3ea894745133f7d81b1610fb475d5
* Rollback: Add sanitizer mode checks that element constructors/destructors ↵Gravatar Evan Brown2023-10-17
| | | | | | | don't make reentrant calls to raw_hash_set member functions. PiperOrigin-RevId: 574232718 Change-Id: I8ef25fec00b76ee5fb9424e7614ca55edd6ba81b
* PR #1546: CMake: Enable CMP0074 so that GTest_ROOT can be specifiedGravatar Daniel Richard G2023-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1546 I am building Abseil with tests enabled and an external GTest build, i.e. ``` -DABSL_BUILD_TESTING=ON -DABSL_USE_EXTERNAL_GOOGLETEST=ON -DABSL_FIND_GOOGLETEST=ON -DGTest_ROOT=/path/to/googletest/1.14.0 ``` However, CMake (3.20.2) configuration yielded this result: ``` -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE CMake Warning (dev) at CMakeLists.txt:150 (find_package): Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables. Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy command to set the policy and suppress this warning. CMake variable GTest_ROOT is set to: /path/to/googletest/1.14.0 For compatibility, CMake is ignoring the variable. This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) Call Stack (most recent call first): /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake/Modules/FindGTest.cmake:255 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:150 (find_package) -- Configuring incomplete, errors occurred! See also "/tmp/abseil-build/CMakeFiles/CMakeOutput.log". See also "/tmp/abseil-build/CMakeFiles/CMakeError.log". ``` This PR sets `CMP0074=NEW` so that the GTest install location can be specified via `GTest_ROOT`. Merge 4e4f035affd9b8af739634afdf9c2e80d14c2391 into 2a18ba753bca64e79f6d9857a9f64e638b32c371 Merging this change closes #1546 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1546 from iskunk:feature/fix-gtest-root 4e4f035affd9b8af739634afdf9c2e80d14c2391 PiperOrigin-RevId: 574159856 Change-Id: Ifc796500c3a6403d28a027375116437bc743205a
* Add sanitizer mode checks that element constructors/destructors don't make ↵Gravatar Evan Brown2023-10-16
| | | | | | | reentrant calls to raw_hash_set member functions. PiperOrigin-RevId: 573897598 Change-Id: If40c23ac3cd9fff315ee18774e27c480cbca3a81
* Add iterator invalidation checking for when the hashtable is moved.Gravatar Evan Brown2023-10-16
| | | | | | Motivation: once we enable small object optimization in swisstable, iterators can be invalidated when the table is moved. PiperOrigin-RevId: 573884505 Change-Id: I4278129829143d3747dfd0ef0ff92f321c2633dc
* Add missing headers in raw_hash_map.h.Gravatar Evan Brown2023-10-12
| | | | | PiperOrigin-RevId: 572979536 Change-Id: I4fceee0c52e4e6877e639860327462c7874719e7
* The current implementation of control by checking on x86 has an unnecessary ↵Gravatar Abseil Team2023-10-12
| | | | | | | | | sign extension after the doing the control byte comparison. Changing the bitmask object to explicitly track only 16 bits (instead of 32) eliminates this, saving an instruction / cycle. This speeds up hit checking by up to 6% on Milan and up to 15% on CLX PiperOrigin-RevId: 572965182 Change-Id: Ifda0e3250d409266d6dcef89cba6ada91d879291
* Delete `absl::strings_internal::HasAbslStringify`.Gravatar Abseil Team2023-10-12
| | | | | | | Users should use `absl::HasAbslStringify` instead. PiperOrigin-RevId: 572916854 Change-Id: Ie67e076e0335b108d23f886a28074f7557ba045a
* Update GoogleTest dependencyGravatar Derek Mauro2023-10-12
| | | | | PiperOrigin-RevId: 572901486 Change-Id: Icb8b8c80cb8b99d9a3203f4971fc53fe64a1ae60
* Bazel: Use --remote_download_minimal to improve remote cache usage in CI buildsGravatar Derek Mauro2023-10-12
| | | | | | | See https://blog.bazel.build/2023/10/06/bwob-in-bazel-7.html PiperOrigin-RevId: 572883468 Change-Id: Ib6f8665bf28f3973ffa3f932d400636b3b97f08a
* No public descriptionGravatar Abseil Team2023-10-11
| | | | | PiperOrigin-RevId: 572612743 Change-Id: I4df4617cacf8fb73d3516537b8e6b63b42447b2e
* Import of CCTZ from GitHub.Gravatar Derek Mauro2023-10-11
| | | | | PiperOrigin-RevId: 572591515 Change-Id: I7d2bd1f737efeeecb8a063ae94a696315bb14532
* Bazel: Enable the header_modules featureGravatar Derek Mauro2023-10-11
| | | | | PiperOrigin-RevId: 572575394 Change-Id: Ic1c5ac2423b1634e50c43bad6daa14e82a8f3e2c
* Bazel: Support layering_check and parse_headersGravatar Derek Mauro2023-10-10
| | | | | | | | | | | | | The layering_check feature ensures that rules that include a header explicitly depend on a rule that exports that header. Compiler support is required, and currently only Clang 16+ supports diagnoses layering_check failures. The parse_headers feature ensures headers are self-contained by compiling them with -fsyntax-only on supported compilers. PiperOrigin-RevId: 572350144 Change-Id: I37297f761566d686d9dd58d318979d688b7e36d1
* ABSL_INTERNAL_HAS_CXA_DEMANGLE: Check __GNUC__ is defined.Gravatar Abseil Team2023-10-09
| | | | | PiperOrigin-RevId: 571929102 Change-Id: I8fb907d047a4ff3bb42e7c7f99454fa687b8f1c9
* Update argument order of `EXPECT_EQ` in `absl::StrJoin` documentation.Gravatar Abseil Team2023-10-06
| | | | | PiperOrigin-RevId: 571487219 Change-Id: I6fbb2ff19db2b6d77e55059004d65c8639eb7fca
* Add entries for Neoverse N2,V1, and V2 into CRC dynamic dispatch table.Gravatar Connal de Souza2023-10-06
| | | | | PiperOrigin-RevId: 571430428 Change-Id: I4777c37c5287d26a75f37fe059324ac218878f0e
* Fix typo in docstring for `absl::c_iota()`Gravatar Abseil Team2023-10-06
| | | | | PiperOrigin-RevId: 571418371 Change-Id: Ie650a4e8c7a9fbb022b1d27e6800765b59fcfc0c
* Fix error in GCC warning suppressionGravatar Derek Mauro2023-10-06
| | | | | PiperOrigin-RevId: 571347014 Change-Id: I716ca435128081f0e9b0434143103df579256f50
* Correct the grammar of an IWYU pragma.Gravatar Abseil Team2023-10-06
| | | | | PiperOrigin-RevId: 571322393 Change-Id: I0e227b0075d3133ee28c8f766a1be7872c101176
* Mark absl::Status as ABSL_ATTRIBUTE_TRIVIAL_ABIGravatar Abseil Team2023-10-05
| | | | | | | This should make it more efficient to pass absl::Status parameters and return values, allowing them to be passed in a register. PiperOrigin-RevId: 571213728 Change-Id: I2a0183aedc08c270d0af0e7a30a07590ea116896
* Fix a small typo in the docs.Gravatar Abseil Team2023-10-05
| | | | | PiperOrigin-RevId: 571084409 Change-Id: I4e6c98ac11f4cb40b65cc9484188faa6168718b4
* With sufficiently high-levels of optimization, this functionGravatar Abseil Team2023-10-04
| | | | | | | | | and those that call it can be inlined sufficiently far to mess up high-level skip-counts. But this function assumes it is the bottommost frame, as in the comment below. PiperOrigin-RevId: 570790048 Change-Id: I4d354f9e79e13aaa6a8a62a9e0870fbeac075de6
* Use ABSL_RAW_LOG and ABSL_PREDICT_* for all debug checks in swisstable ↵Gravatar Evan Brown2023-10-03
| | | | | | | | | including sanitizer mode checks. Sanitizer mode can be used for canaries so performance is still relevant. This change also makes the code more uniform. PiperOrigin-RevId: 570438923 Change-Id: I62859160eb9323e6420680a43fd23e97e8a62389
* Refactor swisstable copy/move assignment to fix issues with allocator ↵Gravatar Evan Brown2023-10-03
| | | | | | | | | | | | | | | | | propagation and improve performance. Correctness: - We use swap to implement copy assignment and move assignment, which means that allocator propagation in copy/move assignment depends on `propagate_on_container_swap` in addition to `propagate_on_container_copy_assignment`/`propagate_on_container_move_assignment`. - In swap, if `propagate_on_container_swap` is `false` and `get_allocator() != other.get_allocator()`, the behavior is undefined (https://en.cppreference.com/w/cpp/container/unordered_set/swap) - we should assert that this UB case isn't happening. For this reason, we also delete the NoPropagateOn_Swap test case in raw_hash_set_allocator_test. Performance: - Don't rely on swap so we don't have to do unnecessary copying into the moved-from sets. - Don't use temp sets in move assignment. - Default the move constructor of CommonFields. - Avoid using exchange in raw_hash_set move constructor. - In `raw_hash_set(raw_hash_set&& that, const allocator_type& a)` with unequal allocators and in move assignment with non-propagating unequal allocators, move set keys instead of copying them. PiperOrigin-RevId: 570419290 Change-Id: I499e54f17d9cb0b0836601f5c06187d1f269a5b8
* Update a dead link.Gravatar Abseil Team2023-10-03
| | | | | | | This cl/ updates the link provided in the comment to point to a valid website. Currently the link points to https://screenshot.googleplex.com/BZhRp6mNJAtjMmz which is now a software company landing page. PiperOrigin-RevId: 570384723 Change-Id: Ib6d17851046125957e092b59d845ddb7ecb1f7b7
* Minor build rule changes.Gravatar Evan Brown2023-10-02
| | | | | PiperOrigin-RevId: 570180405 Change-Id: If14b21a4d0df19546a47923a1f2a359b38fe6f93
* Re-submit with a fix for platforms without RTTI.Gravatar Abseil Team2023-10-02
| | | | | | | We test for `ABSL_INTERNAL_HAS_RTTI` in `absl::container_internal::TypeName` before calling `typeid`. PiperOrigin-RevId: 570101013 Change-Id: I1f2f9b2f475a6beae50d0b88718b17b296311155
* Export common.h from raw_hash_set.h to prevent IWYU from linting when using ↵Gravatar Abseil Team2023-09-27
| | | | | | | node_handle PiperOrigin-RevId: 568997790 Change-Id: I9899ccc95eeb9c8b92d0dceec7e2fc4a2b1102c0
* Delete dead function.Gravatar Abseil Team2023-09-27
| | | | | PiperOrigin-RevId: 568858834 Change-Id: I276efa86259aa425c4b6dff27f037f488a58c9ae
* No public descriptionGravatar Abseil Team2023-09-27
| | | | | PiperOrigin-RevId: 568845530 Change-Id: I8987053041423f1e8b122372f63b0a84e05eb594