1. 24 Sep, 2024 1 commit
    • Optimize `CEscape` and `CEscapeAndAppend` by up to 40%. · ba5fd097
      - Compute the escape character values at compile time.
      - Use `little_endian::Store32` invariably to write all escaped characters.
      - Use 3 slop bytes at the end so that we can safely call `little_endian::Store32` at the end as well.
      
      PiperOrigin-RevId: 677995014
      Change-Id: I9d710fff48d0ce0b013e64d726960364c77ea1d7
      Shahriar Rouf committed
  2. 23 Sep, 2024 1 commit
  3. 20 Sep, 2024 1 commit
  4. 19 Sep, 2024 2 commits
    • Fix benchmarks in `escaping_benchmark.cc` by properly calling… · b3454256
      Fix benchmarks in `escaping_benchmark.cc` by properly calling `benchmark::DoNotOptimize` on both inputs and outputs and by removing the unnecessary and wrong `ABSL_RAW_CHECK` condition (`check != 0`) of `BM_ByteStringFromAscii_Fail` benchmark.
      
      Relevant comment:
      ```
      // The DoNotOptimize(...) function can be used to prevent a value or
      // expression from being optimized away by the compiler. This function is
      // intended to add little to no overhead.
      // See: http://stackoverflow.com/questions/28287064
      //
      // The specific guarantees of DoNotOptimize(x) are:
      //  1) x, and any data it transitively points to, will exist (in a register or
      //     in memory) at the current point in the program.
      //  2) The optimizer will assume that DoNotOptimize(x) could mutate x or
      //     anything it transitively points to (although it actually doesn't).
      //
      // To see this in action:
      //
      //   void BM_multiply(benchmark::State& state) {
      //     int a = 2;
      //     int b = 4;
      //     for (auto s : state) {
      //       testing::DoNotOptimize(a);
      //       testing::DoNotOptimize(b);
      //       int c = a * b;
      //       testing::DoNotOptimize(c);
      //     }
      //   }
      //   BENCHMARK(BM_multiply);
      //
      // Guarantee (2) applied to 'a' and 'b' prevents the compiler lifting the
      // multiplication outside of the loop. Guarantee (1) applied to 'c' prevents the
      // compiler from optimizing away 'c' as dead code.
      ```
      To see #1 and #2 in action, see: https://godbolt.org/z/ned1578ve
      
      PiperOrigin-RevId: 676588185
      Change-Id: I7ed3e4bed8274b54ac7877316f2d82c33d68f00f
      Shahriar Rouf committed
    • It seems like commit abc9b916 did not work as intended. · 162dc789
      PiperOrigin-RevId: 676486501
      Change-Id: I874097a85486534150ce4c2f814d20be9d8b3b1f
      Abseil Team committed
  5. 18 Sep, 2024 1 commit
    • Fix a bug in `absl::SetVLogLevel` where a less generic pattern incorrectly… · 0df56740
      Fix a bug in `absl::SetVLogLevel` where a less generic pattern incorrectly removed a more generic one.
      
      ### Example:
      
      The user passes `--vmodule=*pipeline*=10` to enable logs in files containing `"pipeline"` in their names:
      ```
      pipeline_a.cc
      pipeline_b.cc
      pipeline_c.cc
      ```
      Additionally, `pipeline_a.cc` executes `absl::SetVlogLevel("pipeline_a", 10)`.
      
      ### Expected behavior:
      
      VLOG level `10` is enabled in all files containing `"pipeline"` in their names. `absl::SetVlogLevel("pipeline_a", 10)` should not affect this, as `pipeline_a.cc` is already covered by `--vmodule=*pipeline*=10` and have the same level there.
      
      ### Actual behavior (before the CL):
      
      VLOG level `10` is enabled only in `pipeline_a.cc`. `--vmodule=*pipeline*=10` is ignored.
      
      ### Reason:
      
      `absl::SetVlogLevel` is based on `PrependVModuleLocked`. The issue lies in the following code within `PrependVModuleLocked`:
      
      ```cc
        // This is a memory optimization to avoid storing patterns that will never
        // match due to exit early semantics. Primarily optimized for our own unit
        // tests.
        get_vmodule_info().erase(
            std::remove_if(++iter, get_vmodule_info().end(),
                           [module_pattern](const VModuleInfo& info) {
                             return FNMatch(info.module_pattern, module_pattern);
                           }),
            get_vmodule_info().cend());
      ```
      
      When `absl::SetVlogLevel("pipeline_a", 10)` is executed, `get_vmodule_info()` contains `"*pipeline*"`. Therefore, `info.module_pattern` equals to `"*pipeline*"` and `module_pattern` equals to `"pipeline_a"`.
      
      Because `"pipeline_a"` matches the pattern `"*pipeline*"`, the pattern `"*pipeline*"` is erroneously erased. `get_vmodule_info()` then only contains the `"pipeline_a"` pattern.
      
      ### Solution:
      
      This CL corrects the order of the arguments in `FNMatch` to:
      ```cc
      FNMatch(module_pattern, info.module_pattern);
      ```
      
      This ensures that it correctly checks if the new pattern is more general than the previous pattern, but not vice versa.  In the example above, the new pattern `"pipeline_a"` does not match the previous `"*pipeline*"` pattern. Therefore, `get_vmodule_info()` retains both patterns in the following order: `"pipeline_a"`, `"*pipeline*"`.
      
      PiperOrigin-RevId: 675776298
      Change-Id: I9550dbd4282e66799619369894b8304856a7a777
      Alex Titov committed
  6. 17 Sep, 2024 5 commits
    • Remove the side effects between tests in vlog_is_on_test.cc · 3aa6061a
      The original version of the tests did not reset the VLOG levels between tests, which could lead to false positives. This CL fixes the issue by resetting the VLOG levels to their default values before each test.
      
      PiperOrigin-RevId: 675711787
      Change-Id: Id311ba0c00a9e929afcddc7346882487fd64ea16
      Alex Titov committed
    • Attempt to fix flaky Abseil waiter/sleep tests · abc9b916
      The existing implementation uses wall-clock time. However, wall clock can drastically differ from the internal system clock, because the system can be suspended and then resumed.
      
      We want to account for at least some kinds of suspensions that might occur during automated testing, such as VM suspension or hypervisor preemption ("steal time"). These are tricky cases, because the physical (host) CPU is still running -- just the logical (guest) virtual CPU isn't. Therefore, we need to ensure that our time measurements exclude elapsed host-only time.
      
      Unfortunately the correctness of a method depends on the nature & configuration of each VM and the guest. For example, it can depend whether RDTSC is virtualized, or on whether the host and guest support accounting for steal time. Windows, for example, appears to only support steal time measurements if the hypervisor is Hyper-V.
      
      Since this is all for the sake of testing, we use a simpler trick that we hope will work around the problem on our systems: we subtract the so-called "interrupt time bias" from the system uptime in Windows. The interrupt time bias includes sleep/hibernation time, and seems to advance during for VM suspensions as well, so it may take care of the problem.
      
      PiperOrigin-RevId: 675654840
      Change-Id: I66150b18912175fa72609d3f137e3ea4fee8fc43
      Abseil Team committed
    • Add an explicit tag for non-SOO CommonFields (removing default ctor) and add a… · 9a18cc1a
      Add an explicit tag for non-SOO CommonFields (removing default ctor) and add a small optimization for early return in AssertNotDebugCapacity.
      
      PiperOrigin-RevId: 675640181
      Change-Id: I5ab4cc6eaa0b54932ed70e42ed654f912cf1b099
      Evan Brown committed
    • Make moved-from swisstables behave the same as empty tables. Note that we may… · 857fa4fa
      Make moved-from swisstables behave the same as empty tables. Note that we may change this in the future.
      
      PiperOrigin-RevId: 675576092
      Change-Id: Ibbe1d9d2b644ce6f6182a2d197635d6a0c5327f6
      Evan Brown committed
    • Tag tests that currently fail on darwin_arm64 with "no_test_darwin_arm64" · cbf59087
      This is to prepare for continuous testing on darwin_arm64.
      
      PiperOrigin-RevId: 675532534
      Change-Id: I58e183a3b8cac9cb73f1d0d56e9d41831f02488e
      Abseil Team committed
  7. 16 Sep, 2024 4 commits
  8. 13 Sep, 2024 1 commit
  9. 12 Sep, 2024 2 commits
    • LSC: Fix null safety issues diagnosed by Clang’s `-Wnonnull` and `-Wnullability`. · f555f69b
      **Note**: These changes are generated by hand. Review with care.
      
      This CL changes the `absl_internal` implementations of `AsciiStrToLower()` /
      `AsciiStrToUpper()` to allow `src` to be null. This can, in fact, happen if the
      `string_view` passed to the public API is empty, and the implementations handle
      it correctly. I have added comments noting that `src` is allowed to be null
      iff the size is zero.
      
      `-Wnonnull` diagnoses cases where a `nullptr` literal is passed to a parameter
      annotated nonnull, or where `nullptr` is returned from a function whose return
      type is annotated nonnull.
      
      `-Wnullability` diagnoses cases where nullability annotations conflict, for
      example between the declaration and definition of a function.
      
      PiperOrigin-RevId: 673846759
      Change-Id: I6cf3490ce13837eba9814156c420598000ecc596
      Martin Brænne committed
    • Remove the extraneous variable creation in Match(). · a1a7086e
      PiperOrigin-RevId: 673830978
      Change-Id: I81e52da873dcff75d6a8502578600ec7db50f221
      Abseil Team committed
  10. 11 Sep, 2024 2 commits
    • Import of CCTZ from GitHub. · 1d4466e8
        - d1397431006ea1362a5914d4a90b265d0c7c6f2c Update zoneinfo files to 2024b (#300) by Bradley White <14679271+devbww@users.noreply.github.com>
        - 8bdbd840e97ff32e17f25db85c82589819ad3352 Fix mingw compiler error due to missing function declarat... by Biswapriyo Nath <nathbappai@gmail.com>
        - 6624659e01e73e41527d6b27036e9f79a556560f Add GitHub Actions CI (#299) by Derek Mauro <761129+derekmauro@users.noreply.github.com>
      
      PiperOrigin-RevId: 673451051
      Change-Id: Id39f2186bbdcb802d4fc4c5e21207c6f3709c56f
      Derek Mauro committed
    • Add more debug capacity validation checks on merge/swap. · 0bc0e9a0
      PiperOrigin-RevId: 673403995
      Change-Id: I62d8bb37d4538c340783fb55e5a00694e932b6d1
      Evan Brown committed
  11. 06 Sep, 2024 1 commit
  12. 05 Sep, 2024 2 commits
  13. 04 Sep, 2024 1 commit
  14. 03 Sep, 2024 1 commit
    • Remove first prefetch. · b014bff5
      The rationale behind this being that it is close too close to the first access of the data pointed by the pointer and is of no significant improvement as seen in the benchmarks.
      
      PiperOrigin-RevId: 670574898
      Change-Id: I43a495f23871a2870f4ffd9ab9232083d9668c79
      Abseil Team committed
  15. 30 Aug, 2024 1 commit
  16. 29 Aug, 2024 1 commit
    • Allow slow and fast abseil hardening checks to be enabled independently. · 1031858e
      This change adds a new macro, ABSL_HARDENING_ASSERT_SLOW, which can be used for hardening assertions which have too great a performance impact to enable widely.  It also adds an additional supported value for ABSL_OPTION_HARDENED to only enable assertions which are not slow.  ABSL_OPTION_HARDENED=1 will continue to enable all hardening assertions, while ABSL_OPTION_HARDENED=2 will only enable assertions not marked as SLOW.
      
      PiperOrigin-RevId: 668976425
      Change-Id: I12cb209715d5b359c4093cc8c62e16794d7729b3
      Abseil Team committed
  17. 28 Aug, 2024 3 commits
  18. 27 Aug, 2024 1 commit
  19. 26 Aug, 2024 1 commit
  20. 23 Aug, 2024 1 commit
  21. 22 Aug, 2024 2 commits
  22. 21 Aug, 2024 1 commit
  23. 20 Aug, 2024 1 commit
  24. 19 Aug, 2024 1 commit
  25. 16 Aug, 2024 1 commit
    • PR #1728: Workaround broken compilation against NDK r25 · 8bb5dc43
      Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1728
      
      When targeting Android NDK r25 (reached EOL now, but still in some use) one gets the following error:
      ```
      $(SOURCE_ROOT)/contrib/restricted/abseil-cpp/absl/time/time.h:1762:37: error: invalid operands to binary expression ('std::strong_ordering' and 'const std::strong_ordering')
        if (auto c = lhs_hi <=> rhs_hi; c != std::strong_ordering::equal) {
      ```
      
      The error indicates the lack of `operator<=>` between two `std::strong_ordering` items.
      I believe that this should be controlled by `__cpp_lib_three_way_comparison` (_Three-way comparison (library support)_, see [this article](https://en.cppreference.com/w/cpp/feature_test)), not by `__cpp_impl_three_way_comparison` (which stands for _Three-way comparison (compiler support)_).
      
      Fixes #1725.
      The problem was introduced in a2766235.
      
      Merge 32e1d3d889859ef8a32bf3460349814a2203444c into 69c46839
      
      Merging this change closes #1728
      
      COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1728 from georgthegreat:fix-time 32e1d3d889859ef8a32bf3460349814a2203444c
      PiperOrigin-RevId: 663723253
      Change-Id: I29f7d2b562cc5ad8e11cd46b538ba69acee0f314
      Yuriy Chernyshov committed
  26. 15 Aug, 2024 1 commit