Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless template instantiations #4978

Merged
merged 3 commits into from
May 24, 2022
Merged

Conversation

solotzg
Copy link
Contributor

@solotzg solotzg commented May 23, 2022

What problem does this PR solve?

Issue Number: ref #4909

Problem Summary:

What is changed and how it works?

FunctionsTiDBConversion.h is included in

dbms/src/Common/tests/gtest_mytime.cpp:
dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp:
dbms/src/Flash/Coprocessor/DAGExpressionAnalyzerHelper.cpp:
dbms/src/Functions/FunctionsTiDBConversion.cpp:
dbms/src/Functions/tests/gtest_tidb_conversion.cpp:

But they all will compile class ExecutableFunctionTiDBCast and class FunctionTiDBCast. We need to reduce useless template instantiation.

Before

**** Files that took longest to parse (compiler frontend):
185258 ms: /data2/work/build-llvm-tiflash/dbms/src/Flash/CMakeFiles/flash_service.dir/Coprocessor/DAGExpressionAnalyzerHelper.cpp.o
182847 ms: /data2/work/build-llvm-tiflash/dbms/src/Functions/CMakeFiles/clickhouse_functions.dir/FunctionsTiDBConversion.cpp.o
181468 ms: /data2/work/build-llvm-tiflash/dbms/src/Flash/CMakeFiles/flash_service.dir/Coprocessor/DAGExpressionAnalyzer.cpp.o

**** Templates that took longest to instantiate:
247991 ms: DB::FunctionTiDBCast::createWrapper<false> (3 times, avg 82663 ms)
240476 ms: DB::FunctionTiDBCast::createWrapper<true> (3 times, avg 80158 ms)

**** Template sets that took longest to instantiate:
488467 ms: DB::FunctionTiDBCast::createWrapper<$> (6 times, avg 81411 ms)
419445 ms: DB::FunctionTiDBCast::createWrapperForDecimal<$> (480 times, avg 873 ms)

After

188112 ms: /data2/work/build-llvm-tiflash/dbms/src/Functions/CMakeFiles/clickhouse_functions.dir/FunctionsTiDBConversion.cpp.o
 20012 ms: /data2/work/build-llvm-tiflash/dbms/src/Flash/CMakeFiles/flash_service.dir/Coprocessor/DAGExpressionAnalyzerHelper.cpp.o
 19898 ms: /data2/work/build-llvm-tiflash/dbms/src/Flash/CMakeFiles/flash_service.dir/Coprocessor/DAGExpressionAnalyzer.cpp.o

**** Files that took longest to parse (compiler frontend):
 85109 ms: DB::FunctionTiDBCast<>::createWrapper<false> (1 times, avg 85109 ms)
 84390 ms: DB::FunctionTiDBCast<>::createWrapper<true> (1 times, avg 84390 ms)
...
 144093 ms: DB::FunctionTiDBCast<$>::createWrapperForDecimal<$> (160 times, avg 900 ms)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@solotzg solotzg added the type/enhancement The issue or PR belongs to an enhancement. label May 23, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented May 23, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • guo-shaoge
  • windtalker

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 23, 2022
@solotzg
Copy link
Contributor Author

solotzg commented May 23, 2022

/run-unit-test

@sre-bot
Copy link
Collaborator

sre-bot commented May 23, 2022

Coverage for changed files

Filename                            Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FunctionsTiDBConversion.cpp              19                14    26.32%           3                 1    66.67%          32                22    31.25%          12                10    16.67%
FunctionsTiDBConversion.h               852               432    49.30%          88                26    70.45%        1933               635    67.15%         494               321    35.02%
tests/gtest_tidb_conversion.cpp        4645              1044    77.52%          37                 0   100.00%        1455                 0   100.00%        1468               746    49.18%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                  5516              1490    72.99%         128                27    78.91%        3420               657    80.79%        1974              1077    45.44%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18222      9784             46.31%    204122  97948        52.01%

full coverage report (for internal network access only)

@solotzg
Copy link
Contributor Author

solotzg commented May 23, 2022

/run-integration-test

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 24, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 24, 2022
@solotzg
Copy link
Contributor Author

solotzg commented May 24, 2022

/merge

@ti-chi-bot
Copy link
Member

@solotzg: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5115968

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 24, 2022
@solotzg
Copy link
Contributor Author

solotzg commented May 24, 2022

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 24, 2022
@solotzg solotzg removed the status/can-merge Indicates a PR has been approved by a committer. label May 24, 2022
@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 24, 2022
@solotzg
Copy link
Contributor Author

solotzg commented May 24, 2022

/unhold

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 24, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented May 24, 2022

Coverage for changed files

Filename                            Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FunctionsTiDBConversion.cpp              19                14    26.32%           3                 1    66.67%          32                22    31.25%          12                10    16.67%
FunctionsTiDBConversion.h               852               432    49.30%          88                26    70.45%        1933               635    67.15%         494               321    35.02%
tests/gtest_tidb_conversion.cpp        4645              1044    77.52%          37                 0   100.00%        1455                 0   100.00%        1468               746    49.18%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                  5516              1490    72.99%         128                27    78.91%        3420               657    80.79%        1974              1077    45.44%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18220      9784             46.30%    203962  97962        51.97%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 4448bac into pingcap:master May 24, 2022
@solotzg solotzg deleted the opt branch May 24, 2022 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants