Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up date_trunc function (#8122)
Summary: `date_trunc` function is not very efficient now, when timezone is not considered, the length of a day/hour/minute is fixed. So we can speed up the `date_trunc` function for day/hour/minute unit by some simple arithmetic. This resulted in a 25x speed up in the benchmark. ``` ➜ ./_build/release/velox/functions/prestosql/benchmarks/velox_functions_prestosql_benchmarks_date_time WARNING: Benchmark running in DEBUG mode ============================================================================ [...]osql/benchmarks/DateTimeBenchmark.cpp relative time/iter iters/s ============================================================================ truncYear 108.28ms 9.23 truncMonth 110.60ms 9.04 truncDay 4.26ms 234.80 truncHour 4.14ms 241.70 truncMinute 4.48ms 223.19 truncSecond 3.62ms 276.45 year 32.24ms 31.01 month 31.89ms 31.36 day 31.39ms 31.86 hour 34.26ms 29.19 hour_vector 67.25% 50.95ms 19.63 minute 34.81ms 28.73 second 31.35ms 31.90 ``` Pull Request resolved: #8122 Reviewed By: bikramSingh91 Differential Revision: D58370105 Pulled By: kevinwilfong fbshipit-source-id: 72697cc62b88564c8beae848dc0ae17fe67d0609
- Loading branch information