MCPcopy Create free account
hub / github.com/apache/impala / main

Function main

be/src/benchmarks/parse-timestamp-benchmark.cc:233–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233int main(int argc, char **argv) {
234 CpuInfo::Init();
235 cout << Benchmark::GetMachineInfo() << endl;
236
237 SimpleDateFormatTokenizer::InitCtx();
238
239 TestData dates, times, datetimes, tzdatetimes;
240
241 AddTestDataDates(&dates, 700, "1953-04-22");
242 AddTestDataTimes(&times, 700, "01:02:03.45678");
243 AddTestDataDateTimes(&datetimes, 700, "1953-04-22 01:02:03");
244 AddTestDataTZDateTimes(&tzdatetimes, 700, "1990-04-22 01:10:03");
245
246 dates.result.resize(dates.data.size());
247 times.result.resize(times.data.size());
248 datetimes.result.resize(datetimes.data.size());
249 tzdatetimes.result.resize(tzdatetimes.data.size());
250
251 Benchmark date_suite("ParseDate");
252 date_suite.AddBenchmark("BoostStringDate", TestBoostStringDate, &dates);
253 date_suite.AddBenchmark("BoostDate", TestBoostDate, &dates);
254 date_suite.AddBenchmark("Impala", TestImpalaSimpleDateFormat, &dates);
255
256 Benchmark timestamp_suite("ParseTimestamp");
257 timestamp_suite.AddBenchmark("BoostTime", TestBoostTime, &times);
258 timestamp_suite.AddBenchmark("Impala", TestImpalaSimpleDateFormat, &times);
259
260 dt_ctx_simple_date_format.Reset("yyyy-MM-dd HH:mm:ss", 19);
261 SimpleDateFormatTokenizer::Tokenize(&dt_ctx_simple_date_format, PARSE);
262 dt_ctx_tz_simple_date_format.Reset("yyyy-MM-dd HH:mm:ss+hh:mm", 25);
263 SimpleDateFormatTokenizer::Tokenize(&dt_ctx_tz_simple_date_format, PARSE);
264
265 dt_ctx_iso_sql_format.Reset("YYYY-MM-DD HH24:MI:SS", 21);
266 datetime_parse_util::IsoSqlFormatTokenizer tokenizer(&dt_ctx_iso_sql_format,
267 datetime_parse_util::PARSE, true);
268 tokenizer.Tokenize();
269
270 dt_ctx_tz_iso_sql_format.Reset("YYYY-MM-DD HH24:MI:SSTZH:TZM", 28);
271 tokenizer.Reset(&dt_ctx_tz_iso_sql_format, datetime_parse_util::PARSE, true);
272 tokenizer.Tokenize();
273
274 Benchmark timestamp_with_format_suite("ParseTimestampWithFormat");
275 timestamp_with_format_suite.AddBenchmark("BoostDateTime",
276 TestBoostDateTime, &datetimes);
277 timestamp_with_format_suite.AddBenchmark("ImpalaSimpleDateFormatTimeStamp",
278 TestImpalaSimpleDateFormatTimestamp, &datetimes);
279 timestamp_with_format_suite.AddBenchmark("ImpalaSimpleDateFormatTZTimeStamp",
280 TestImpalaSimpleDateFormatTZTimestamp, &tzdatetimes);
281 timestamp_with_format_suite.AddBenchmark("ImpalaIsoSqlFormatTimeStamp",
282 TestImpalaIsoSqlFormatTimestamp, &datetimes);
283 timestamp_with_format_suite.AddBenchmark("ImpalaIsoSqlFormatTZTimeStamp",
284 TestImpalaIsoSqlFormatTZTimestamp, &tzdatetimes);
285
286 cout << date_suite.Measure();
287 cout << endl;
288 cout << timestamp_suite.Measure();
289 cout << endl;
290 cout << timestamp_with_format_suite.Measure();

Callers

nothing calls this directly

Calls 10

AddTestDataDatesFunction · 0.85
AddTestDataTimesFunction · 0.85
AddTestDataTZDateTimesFunction · 0.85
resizeMethod · 0.80
AddBenchmarkMethod · 0.80
AddTestDataDateTimesFunction · 0.70
sizeMethod · 0.45
ResetMethod · 0.45
TokenizeMethod · 0.45
MeasureMethod · 0.45

Tested by

no test coverage detected