-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improvement](function) add timezone cache for convert_tz #14616
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
Conversation
|
TeamCity pipeline, clickbench performance test result: |
902afd5 to
5090d40
Compare
2697030 to
d764011
Compare
Yukang-Lian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by anyone and no changes requested. |
d764011 to
f557105
Compare
f557105 to
cced55f
Compare
| size_t input_rows_count) { | ||
| auto convert_ctx = reinterpret_cast<ConvertTzCtx*>( | ||
| context->get_function_state(FunctionContext::FunctionStateScope::THREAD_LOCAL)); | ||
| std::map<StringRef, cctz::time_zone> time_zone_cache_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| std::map<StringRef, cctz::time_zone> time_zone_cache_; | |
| std::map<StringRef, cctz::time_zone> time_zone_cache; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time_zone_cache_ is a temporary map.
time_zone_cache is a reference to the map.
Gabriel39
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Proposed changes
cctz::fixed_time_zonewill lock&unlock the mutex in each call, this is a non-negligible performance cost.This PR adds a map to cache the timezone to avoid finding the same timezone repeatedly.
Problem summary
Describe your changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...