Export of internal Abseil changes.
-- 906c47420646d510edd2479d5542c56f5fa31b65 by CJ Johnson <johnsoncj@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 216573923 -- 74560d4afd2b605909e677c6fc3076049fb3010a by Eric Fiselier <ericwf@google.com>: Avoid -Wformat-pedantic in benchmark. PiperOrigin-RevId: 216523769 -- 9bcc9da8b03e6d1ea43ee78931256c5541cb9686 by Eric Fiselier <ericwf@google.com>: Delete unused CityHash functions. PiperOrigin-RevId: 216464492 -- a42563b394c89fbb4c55cb5a6a5edbf96d271eea by Abseil Team <absl-team@google.com>: Introduce new Abseil interfaces for converting between civil times and absolute times.s Deprecates absl::ConvertDateTime() and absl::FromDateTime(). PiperOrigin-RevId: 216424948 -- 088e11235124267517d7f137854fa5554679c24f by Eric Fiselier <ericwf@google.com>: Remove unneeded break statements in test. PiperOrigin-RevId: 216403321 GitOrigin-RevId: 906c47420646d510edd2479d5542c56f5fa31b65 Change-Id: Idb44420be623e369c66f5a9c92bdc9ab46d3ec92
This commit is contained in:
parent
445998d7ac
commit
f340f773ed
24 changed files with 2675 additions and 2592 deletions
|
|
@ -169,32 +169,32 @@ void BM_Time_ToUnixSeconds(benchmark::State& state) {
|
|||
BENCHMARK(BM_Time_ToUnixSeconds);
|
||||
|
||||
//
|
||||
// FromDateTime
|
||||
// FromCivil
|
||||
//
|
||||
// In each "FromDateTime" benchmark we switch between two YMDhms
|
||||
// values separated by at least one transition in order to defeat any
|
||||
// internal caching of previous results (e.g., see time_local_hint_).
|
||||
// In each "FromCivil" benchmark we switch between two YMDhms values
|
||||
// separated by at least one transition in order to defeat any internal
|
||||
// caching of previous results (e.g., see time_local_hint_).
|
||||
//
|
||||
// The "UTC" variants use UTC instead of the Google/local time zone.
|
||||
// The "Day0" variants require normalization of the day of month.
|
||||
//
|
||||
|
||||
void BM_Time_FromDateTime_Absl(benchmark::State& state) {
|
||||
void BM_Time_FromCivil_Absl(benchmark::State& state) {
|
||||
const absl::TimeZone tz =
|
||||
absl::time_internal::LoadTimeZone("America/Los_Angeles");
|
||||
int i = 0;
|
||||
while (state.KeepRunning()) {
|
||||
if ((i & 1) == 0) {
|
||||
absl::FromDateTime(2014, 12, 18, 20, 16, 18, tz);
|
||||
absl::FromCivil(absl::CivilSecond(2014, 12, 18, 20, 16, 18), tz);
|
||||
} else {
|
||||
absl::FromDateTime(2013, 11, 15, 18, 30, 27, tz);
|
||||
absl::FromCivil(absl::CivilSecond(2013, 11, 15, 18, 30, 27), tz);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_Time_FromDateTime_Absl);
|
||||
BENCHMARK(BM_Time_FromCivil_Absl);
|
||||
|
||||
void BM_Time_FromDateTime_Libc(benchmark::State& state) {
|
||||
void BM_Time_FromCivil_Libc(benchmark::State& state) {
|
||||
// No timezone support, so just use localtime.
|
||||
int i = 0;
|
||||
while (state.KeepRunning()) {
|
||||
|
|
@ -219,32 +219,32 @@ void BM_Time_FromDateTime_Libc(benchmark::State& state) {
|
|||
++i;
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_Time_FromDateTime_Libc);
|
||||
BENCHMARK(BM_Time_FromCivil_Libc);
|
||||
|
||||
void BM_Time_FromDateTimeUTC_Absl(benchmark::State& state) {
|
||||
void BM_Time_FromCivilUTC_Absl(benchmark::State& state) {
|
||||
const absl::TimeZone tz = absl::UTCTimeZone();
|
||||
while (state.KeepRunning()) {
|
||||
FromDateTime(2014, 12, 18, 20, 16, 18, tz);
|
||||
absl::FromCivil(absl::CivilSecond(2014, 12, 18, 20, 16, 18), tz);
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_Time_FromDateTimeUTC_Absl);
|
||||
BENCHMARK(BM_Time_FromCivilUTC_Absl);
|
||||
|
||||
void BM_Time_FromDateTimeDay0_Absl(benchmark::State& state) {
|
||||
void BM_Time_FromCivilDay0_Absl(benchmark::State& state) {
|
||||
const absl::TimeZone tz =
|
||||
absl::time_internal::LoadTimeZone("America/Los_Angeles");
|
||||
int i = 0;
|
||||
while (state.KeepRunning()) {
|
||||
if ((i & 1) == 0) {
|
||||
absl::FromDateTime(2014, 12, 0, 20, 16, 18, tz);
|
||||
absl::FromCivil(absl::CivilSecond(2014, 12, 0, 20, 16, 18), tz);
|
||||
} else {
|
||||
absl::FromDateTime(2013, 11, 0, 18, 30, 27, tz);
|
||||
absl::FromCivil(absl::CivilSecond(2013, 11, 0, 18, 30, 27), tz);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_Time_FromDateTimeDay0_Absl);
|
||||
BENCHMARK(BM_Time_FromCivilDay0_Absl);
|
||||
|
||||
void BM_Time_FromDateTimeDay0_Libc(benchmark::State& state) {
|
||||
void BM_Time_FromCivilDay0_Libc(benchmark::State& state) {
|
||||
// No timezone support, so just use localtime.
|
||||
int i = 0;
|
||||
while (state.KeepRunning()) {
|
||||
|
|
@ -269,7 +269,7 @@ void BM_Time_FromDateTimeDay0_Libc(benchmark::State& state) {
|
|||
++i;
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_Time_FromDateTimeDay0_Libc);
|
||||
BENCHMARK(BM_Time_FromCivilDay0_Libc);
|
||||
|
||||
//
|
||||
// To/FromTimespec
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue