googletest/googletest/include/gtest
Abseil Team e1a38bc370 Reland: Optimize Google Test process startup
Google Test performs hidden test registration during process
startup. For test binaries that contain a large number of tests, this
registration can be costly. In this CL, we reduce the overhead of
registration via several tactics:

- Treat CodeLocation and FilePath as value types, using std::move to
  pass them around.
- Reduce string copies in various places by either passing std::string
  values via std::move, or passing const-refs to std::string instances.
- Use std::to_string to stringify an int in DefaultParamName rather than
  a std::stringstream.
- Pull some std::string instances out of nested loops in
  ParameterizedTestSuiteInfo::RegisterTests so as to reuse some
  allocations, and replace stringstream with ordinary string appends.
- Use std::unordered_map in UnitTestImpl::GetTestSuite and
  ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder to spend a
  little memory to turn O(N) lookups into constant time lookpus.
- Use range-based for loops in a few places.
- Use emplace-ish methods to add to containers where appropriate.

All together, these changes reduce the overall runtime of a series of 50
death tests in a single Chromium test executable by ~38% due to the
fact that the registration costs are paid in every death test's child
process.

PiperOrigin-RevId: 613833210
Change-Id: I51a262a770edff98ffa1e3b60c4d78a8308f9a9f
2024-03-07 23:53:47 -08:00
..
internal Reland: Optimize Google Test process startup 2024-03-07 23:53:47 -08:00
gtest_pred_impl.h Running clang-format over all of GoogleTest 2022-03-15 13:42:11 -07:00
gtest_prod.h Running clang-format over all of GoogleTest 2022-03-15 13:42:11 -07:00
gtest-assertion-result.h Use std::make_unique 2023-04-20 13:09:18 -07:00
gtest-death-test.h Use "#ifdef" with public macros 2023-03-06 07:15:44 -08:00
gtest-matchers.h Use '=default' to define trivial constructor/destructors 2023-04-21 10:41:25 -07:00
gtest-message.h Use absl::HasAbslStringify, instead of the internal version. 2023-09-21 10:32:25 -07:00
gtest-param-test.h Fix formatting of C++ files 2023-01-24 11:10:09 -08:00
gtest-printers.h Fix double-promotion warnings in AppropriateResolution() 2024-01-23 07:02:53 -08:00
gtest-spi.h IWYU: Add missing std includes 2023-01-05 08:44:01 -08:00
gtest-test-part.h Use '=default' to define trivial constructor/destructors 2023-04-21 10:41:25 -07:00
gtest-typed-test.h Fix formatting of C++ files 2023-01-24 11:10:09 -08:00
gtest.h Reland: Optimize Google Test process startup 2024-03-07 23:53:47 -08:00