[env](compiler)educe template instantiations in datetime floor/ceil functions#61515
Open
Mryange wants to merge 1 commit intoapache:masterfrom
Open
[env](compiler)educe template instantiations in datetime floor/ceil functions#61515Mryange wants to merge 1 commit intoapache:masterfrom
Mryange wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
TPC-H: Total hot run time: 26664 ms |
TPC-DS: Total hot run time: 169658 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
function_datetime_floor_ceil.cpphas excessive template instantiation bloat. The classFunctionDateTimeFloorCeil<Flag, PType, ArgNum, UseDelta>has 4 template parameters, producing 192 instantiations. However, all heavy computation functions (9vector_*variants,time_round_two_args,floor_opt, etc.) only depend onFlagandPType— they never useArgNumorUseDelta. This means these expensive functions are compiled 4x more than necessary.This PR applies three optimizations:
Extract
DateTimeFloorCeilCore<Flag, PType>struct: All heavy computation functions are moved into a separate struct with only 2 template parameters.FunctionDateTimeFloorCeilbecomes a thin shell that delegates toCore::vector_*(). This reduces instantiations of the heaviest code from 192 → 48 (÷4).Extract
convert_utc_to_local_impl<DateValueType>free function: This function only depends onDateValueType, notFlag/ArgNum/UseDelta. Extracting it reduces its instantiations from 192 → 3.Extract
FunctionDateTimeFloorCeilBasenon-template base class: Three virtual overrides (get_number_of_arguments,is_variadic,use_default_implementation_for_nulls) use zero template parameters. Moving them to a non-template base eliminates 192 redundant copies.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)