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

frontend: eliminate unnecessary RwError construction (backtrace capture) #6157

Closed
3 tasks done
BugenZhao opened this issue Nov 1, 2022 · 3 comments
Closed
3 tasks done
Assignees
Labels
component/frontend Protocol, parsing, binder. priority/high type/bug Something isn't working

Comments

@BugenZhao
Copy link
Member

BugenZhao commented Nov 1, 2022

As explained in #6131, capturing a backtrace on M1 Mac can be really slow after an LLVM upgrade. The profiling result shows that we're creating a lot of RwError, which captures the backtrace on construction, even though there's no user-facing error during the planning.

Actually, we're abusing the error handling of Rust: it's convincing that the compiler does not tend to optimize the code for the error branch which is believed to happen rarely, especially for the dev profile. We should prefer using Option in this case, or a lightweight error type (without backtrace capturing) at least.

Here're several functions that construct RwError frequently and hurt the performance a lot:

Note that we have eliminated most of the RwErrors in our system except for batch, and frontend, so that we can decide whether a backtrace is helpful and whether to put it in the per-module error type, instead of always capturing the backtrace as RwError does. So I believe the final solution should be #4077. 😄

We should consider eliminating unnecessary RwError construction them first. If this is hard, removing the backtrace from the RwError may also be a temporal workaround.

cc @xxchan @skyzh @fuyufjh @xiangjinwu

@BugenZhao BugenZhao added type/bug Something isn't working component/frontend Protocol, parsing, binder. priority/high labels Nov 1, 2022
@github-actions github-actions bot added this to the release-0.1.14 milestone Nov 1, 2022
@BugenZhao BugenZhao changed the title frontend: eliminate unnecessary RwError construction frontend: eliminate unnecessary RwError construction (backtrace capture) Nov 1, 2022
@skyzh
Copy link
Contributor

skyzh commented Nov 2, 2022

Shall we also rethink about the TracedHummockError / TracedStreamError (but I believe they are only thrown when there's really an error)

@fuyufjh
Copy link
Member

fuyufjh commented Nov 10, 2022

Hi, is this completed?

@xxchan
Copy link
Member

xxchan commented Nov 10, 2022

I think it's done and similar situations in the future can be solved similarly case-by-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/frontend Protocol, parsing, binder. priority/high type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants