You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/08/11 12:53:50 UTC
[GitHub] [doris] platoneko opened a new issue, #11698: [Enhancement] Separate code and err msg in Status and save err msg in heap
platoneko opened a new issue, #11698:
URL: https://github.com/apache/doris/issues/11698
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
### Description
The current `Status` implementation is to save all data to a fixed size (2KB) array on stack. This will lead to too large function stack space and may not be friendly to data locality (unnecessary page faults, TLB utilization, cacheline prefetching, etc.).
Another problem is when RVO(return value optimization) fails (there are many if-else branches in current codes, and the compiler may often be unable to do RVO), the move ctor cannot be used, causing the error message in `Status` to be copied layer by layer in the function call stack.
Doris moving the `Status` data from heap to stack can be traced back to https://github.com/apache/doris/pull/8117. This PR is designed to avoid dynamic memory allocation. However, in practice, we often construct error messages through `fmt::format`(see `Status::ErrorFmt`), so we cannot avoid dynamic memory allocation in fact.
If we separate the status code and err msg in `Status`:
1. The error msg constructed by `fmt::format` can be directly moved to `Status`.
2. When RVO fails, the compiler will use move ctor to pass Status to function caller to reduce the copy cost.
### Solution
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei closed issue #11698: [Enhancement] Separate code and err msg in Status and save err msg in heap
Posted by GitBox <gi...@apache.org>.
yiguolei closed issue #11698: [Enhancement] Separate code and err msg in Status and save err msg in heap
URL: https://github.com/apache/doris/issues/11698
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org