Export of internal Abseil changes

--
509c39cb5aa70893a180e5625e06cd9f76061ecf by Shaindel Schwartz <shaindel@google.com>:

Release CivilTime parsing API.

PiperOrigin-RevId: 270262448
GitOrigin-RevId: 509c39cb5aa70893a180e5625e06cd9f76061ecf
Change-Id: I343eb3062cdf6a2c53e6fddcaa35eb25d7478b1a
This commit is contained in:
Abseil Team 2019-09-20 07:07:04 -07:00 committed by Shaindel Schwartz
parent ddf8e52a29
commit ccdd1d57b6
4 changed files with 319 additions and 0 deletions

View file

@ -66,6 +66,26 @@ void BM_Format(benchmark::State& state) {
}
BENCHMARK(BM_Format);
void BM_Parse(benchmark::State& state) {
const std::string f = "2014-01-02T03:04:05";
absl::CivilSecond c;
while (state.KeepRunning()) {
const bool b = absl::ParseCivilTime(f, &c);
benchmark::DoNotOptimize(b);
}
}
BENCHMARK(BM_Parse);
void BM_RoundTripFormatParse(benchmark::State& state) {
const absl::CivilSecond c(2014, 1, 2, 3, 4, 5);
absl::CivilSecond out;
while (state.KeepRunning()) {
const bool b = absl::ParseCivilTime(absl::FormatCivilTime(c), &out);
benchmark::DoNotOptimize(b);
}
}
BENCHMARK(BM_RoundTripFormatParse);
template <typename T>
void BM_CivilTimeAbslHash(benchmark::State& state) {
const int kSize = 100000;